无法通过预先设置来自动创建用户

无法通过预先设置来自动创建用户

我正在使用以下 virt-install 选项和 preseed.cfg 创建 KVM 客户机,并且始终显示用户创建对话框“[!!] 设置用户和密码”。

我该如何通过预先植入来实现该部分的自动化?

当然,我检查了我的 preseed.cfg 是否正确debconf-set-selections -c preseed.cfg

[安装.sh]

#!/bin/bash
sudo virt-install \
--name=test \
--connect=qemu:///system \
--ram=2048 \
--vcpus=2 \
--os-variant=ubuntuprecise \
--hvm \
--virt-type=kvm \
--network=bridge:br0 \
--location=http://mirrors.usc.edu/pub/linux/distributions/ubuntu/dists/precise/main/installer-amd64/ \
--file=test.img \
--graphics vnc,port=5901,password=test,listen=0.0.0.0,keymap=ja \
--extra-args="auto=true priority=critical initrd=/install/initrd.gz preseed/file=preseed.cfg"

[预置.cfg]

d-i debian-installer/locale string ja_JP
d-i console-keymaps-at/keymap select ja

d-i netcfg/get_nameservers string 8.8.8.8
d-i netcfg/get_ipaddress string 192.168.1.50
d-i netcfg/get_netmask string 255.255.255.0
d-i netcfg/get_gateway string 192.168.1.1
d-i netcfg/choose_interface select eth0
d-i netcfg/disable_dhcp boolean true
d-i netcfg/dhcp_options select Configure network manually
d-i netcfg/confirm_static boolean true
d-i netcfg/get_hostname string test
d-i netcfg/get_hostname seen false
d-i netcfg/get_domain string ymotongpoo.local

d-i mirror/protocol string http
d-i mirror/country string manual
d-i mirror/http/hostname string archive.ubuntu.com
d-i mirror/http/directory string /ubuntu
d-i mirror/http/proxy string

d-i clock-setup/utc boolean true
d-i time/zone string Asia/Tokyo
d-i clock-setup/ntp boolean true

d-i partman-auto/disk string /dev/vda
d-i partman-lvm/device_remove_lvm boolean true
d-i partman-md/device_remove_md boolean true

d-i partman-auto/method string regular
d-i partman-lvm/confirm boolean true

d-i partman-auto-lvm/guided_size string max
d-i partman-auto/choose_recipe select atomic

d-i partman/default_filesystem string ext4

d-i partman/confirm_write_new_label boolean true
d-i partman/choose_partition select finish
d-i partman/confirm boolean true
d-i partman/confirm_nooverwrite boolean true

d-i passwd/user-fullname string Ubuntu User
d-i passwd/username string ubuntu
d-i passwd/user-password password spameggham
d-i passwd/user-password-again password spameggham
d-i user-setup/allow-password-weak boolean true

tasksel tasksel/first multiselect standard
d-i pkgsel/include string openssh-server fail2ban zile vim puppet
d-i pkgsel/upgrade select safe-upgrade
d-i pkgsel/language-packs multiselect en, ja
d-i pkgsel/update-policy select none
d-i pkgsel/updatedb boolean false

popularity-contest popularity-contest/participate boolean false

d-i grub-installer/only_debian boolean true
d-i grub-installer/with_other_os boolean true
d-i finish-install/reboot_in_progress note

答案1

尝试使用如下散列密码:

$ mkpasswd -m sha-512
Password: 
$6$ONf5M3F1u$bpljc9f1SPy1w4J2br5BWbE38lPlbBGgjbkJ6MnrvQK2kUfFyT/r0p.R22FFPMAc61B9BD/UWcXoui4qXInx01

然后在你的预置文件中:

# User account
d-i passwd/root-login boolean false
d-i passwd/user-fullname string My Full Name Here
d-i passwd/username string myusername
d-i passwd/user-password-crypted password $6$ONf5M3F1u$bpljc9f1SPy1w4J2br5BWbE38lPlbBGgjbkJ6MnrvQK2kUfFyT/r0p.R22FFPMAc61B9BD/UWcXoui4qXInx01

这对我有用。

作为奖励,您的预置文件中不再有纯密码。

相关内容