virt-customize
TLDR
Set root password
SYNOPSIS
virt-customize -a image [options]
DESCRIPTION
virt-customize modifies virtual machine disk images by installing packages, editing configuration, uploading files, and running scripts. It is part of the libguestfs tools suite.
The tool works by mounting the disk image using libguestfs and performing operations in a secure, isolated environment. The VM must be shut down before customization.
Customization scripts run inside a small appliance chrooted into the guest filesystem. Limited network access is available for package downloads.
This tool is useful for preparing cloud images, creating golden images, and automating VM provisioning.
PARAMETERS
-a, --add file
Disk image file to customize.--root-password method:arg
Set root password.--password user:method:arg
Set user password.--install packages
Install packages (comma-separated).--uninstall packages
Remove packages.--update
Update all packages.--upload local:remote
Upload file to image.--copy-in local:remotedir
Copy files/dirs into image.--run script
Run shell script in image.--run-command cmd
Run single command.--ssh-inject user:file:keyfile
Inject SSH public key.--timezone tz
Set timezone.--hostname name
Set hostname.--edit file:expr
Edit file with Perl expression.--delete path
Delete file or directory.--commands-from-file file
Read commands from file.-v, --verbose
Enable verbose output.
CAVEATS
VM must be shut down. Don't run as root unless necessary. Snapshot disk before modifying production images. Some operations require specific guest OS support. SELinux relabeling may be needed.
HISTORY
virt-customize is part of libguestfs, created by Red Hat for virtual machine image manipulation. The toolset provides safe, scriptable access to VM disk images without requiring the guest to be running.
SEE ALSO
virt-sysprep(1), virt-builder(1), guestfish(1), guestmount(1)


