New in virt-sysprep: Set root and user passwords

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 Comments

Filed under Uncategorized

4 responses to “New in virt-sysprep: Set root and user passwords

  1. novelkumar

    Hi,
    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??

  2. Luis Chiang

    Hi,

    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 :

    #virt-sysprep --root-password password:123456 -a Fedora-x86_64-20-20140407-sda.raw
    

    But I’m getting the error:

    virt-sysprep: unknown option `--root-password'.
    virt-sysprep: reset or unconfigure a virtual machine so clones can be made
    

    Could you please help me giving some idea how to access the vm? thanks!

    • rich

      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).

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s