Sed-like configuration file editing with virt-edit

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::/'

1 Comment

Filed under Uncategorized

One response to “Sed-like configuration file editing with virt-edit

  1. frankiii

    Must. Backport. To. EPEL5.

    I’m dying here in 1.2.11 land!šŸ™‚

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