New in virt-sysprep ≥ 1.23.13 is the ability to set root and user passwords in Linux guests (previous manual method is described here).
$ virt-sysprep \ --root-password password:123456 \ --password joe:file:/tmp/secret -a guest.img
You shouldn’t normally specify the cleartext password on the command line, although it’s useful for testing. You should usually provide a file containing the password, ensuring that it is not readable by other users on the system (ie. mode 0600).
4 responses to “New in virt-sysprep: Set root and user passwords”
I tried it in Centos 6.4 box and i am getting error about password and root-password option not there.. see the following error message:
# virt-sysprep –root-password password:123456 –password cirros:123456 -a cirros-0.3.0-x86_64-disk.img
virt-sysprep: unrecognized option ‘–root-password’
virt-sysprep: unrecognized option ‘–password’
virt-sysprep: problem parsing the command line arguments
The man page also does not show the option. Am i missing something obvious??
You need the RHEL 6.5 packages, so either wait for CentOS 6.5 to be released or use the preview repository here:
--passwordoption is wrong. It should be something like:
--password cirros:password:123456(check the man page).
You have a really nice blog. I’m trying to use the latest fedora cloud release using virsh/qemu but I’m not able to login into the machine, then I realize that I need to setup a ssh key or password. I’m running :
But I’m getting the error:
Could you please help me giving some idea how to access the vm? thanks!
What version of virt-sysprep are you running? It should work if you use a recent version (eg. ≥ 1.26 is the latest supported stable version).