Hi,
On Tuesday, 5 December 2017 14:24:42 CET Guido Schmidt wrote:
Version 1.34.6 (on Debian Stretch)
Using virt-builder I tried to create a user and inject my ssh key:
virt-builder -v -x centos-7.4 --output testimage --format qcow2
--selinux-relabel --hostname testimage --firstboot-command 'useradd -m
-p "" dummy' --firstboot-command 'chage -d 0 dummy' --ssh-inject
dummy
...
[ 16.1] Installing firstboot command: useradd -m -p "" dummy
[ 16.1] Installing firstboot command: chage -d 0 dummy
[ 16.1] SSH key inject: dummy
virt-builder: error: ssh-inject: the user dummy does not exist on the guest
(Full debug output attached)
Seems like this can never work as the injection is carried out before
the first boot. Is this a bug in my version? Or is this limited to users
that are already in the image?
The injection of SSH keys (using --ssh-inject) is performed during the
image customization process, i.e. while virt-builder/virt-customize run.
Theoretically it should be possible to create the user directly in this
phase, so the SSH injection works, and then force the password change on
first login (with chage, as you used already).
--
Pino Toscano