LinuxCommandLibrary

qm-guest-passwd

Change or reset a guest VM password

TLDR

Set a password for a specific user in a virtual machine interactively

$ qm guest passwd [vm_id] [username]
copy

Set an already hashed password for a specific user in a virtual machine interactively
$ qm guest passwd [vm_id] [username] --crypted 1
copy

SYNOPSIS

qm guest cmd passwd [OPTIONS]

PARAMETERS

vmid
    The ID of the virtual machine.

username
    The username of the user whose password you want to change.

password
    The new password for the user.

--setuser
    Use specified user for authentication. Defaults to 'root'.

--iterations
    Number of iterations for password hashing. Defaults to 4096.

--method
    Password hashing method to use (crypt, sha256, sha512). Defaults to sha512.

--password
    Password for user used for authentication

DESCRIPTION

The `qm-guest-passwd` command allows you to change the password of a user within a virtual machine guest OS running under Proxmox Virtual Environment (PVE). It interacts with the QEMU Guest Agent running inside the VM to perform the password change. This method avoids direct access to the VM's disk image or console, providing a more secure way to manage user credentials. The command requires the QEMU Guest Agent to be installed and running inside the VM, and the agent service enabled in the PVE VM configuration.

Password changes will only work with users that exist inside the VM OS.

Using this command simplifies password management, especially when dealing with multiple VMs. It leverages the guest agent for authentication and password modification inside the guest OS, removing the need to log in and execute commands manually.

CAVEATS

  • Requires the QEMU Guest Agent to be installed and running inside the VM.
  • The agent service must be enabled in the PVE VM configuration.
  • Password complexity requirements are dictated by the guest OS.
  • The command needs privileges to execute password changes, typically root or an equivalent account inside the VM.

EXAMPLE

To change the password of user 'testuser' on VM 100 to 'newpassword', run:
qm guest cmd 100 passwd testuser newpassword

SEE ALSO

qm(1), qemu-guest-agent(8)

Copied to clipboard