A new option in virt-edit lets you non-interactively edit files in a virtual machine, somewhat like using sed
or perl -pe
. For example, change the init default level to 3:
virt-edit test.img /etc/inittab -e 's/^id:.*/id:3:initdefault:/'
Delete the root password from a VM:
virt-edit test.img /etc/passwd -e 's/^root:.*?:/root::/'
Must. Backport. To. EPEL5.
I’m dying here in 1.2.11 land! π