It can sometimes be handy to be able to reset passwords or even un/install packages in Linux images or templates.For example, you have downloaded the latest Ubuntu or CentOS image, but the root password is disabled or randomised and you really don't want cloud-init to mess it up again.
Here's how to set the root password to "password" and uninstall cloud-init package. man virt-customize for (a lot) more options!
~]# yum -y install libguestfs-tools-c # package name may vary on your distro ~]# virt-customize -a File.qcow2 --root-password password:password --uninstall cloud-init [ 0.0] Examining the guest ... [ 5.8] Setting a random seed [ 5.8] Uninstalling packages: cloud-init [ 9.8] Setting passwords [ 11.6] Finishing off
virt-edit -a File.qcow2 /etc/ssh/sshd_config