How to use the command 'qm guest passwd' (with examples)
This article provides examples of using the command ‘qm guest passwd’ in QEMU/KVM Virtual Machine Manager.
Use case 1: Set a password for a specific user in a virtual machine interactively
Code:
qm guest passwd vm_id username
Motivation: The motivation for using this use case is to set a password for a specific user in a virtual machine when the exact password is known.
Explanation:
- ‘qm guest passwd’: This is the command to set the password for a specific user in a virtual machine.
- ‘vm_id’: This is the ID of the virtual machine for which the password needs to be set.
- ‘username’: This is the username for which the password needs to be set.
Example output:
Enter new guest password for user 'username':
Confirm password:
Password changed successfully for user 'username' in virtual machine 'vm_id'.
Use case 2: Set an already hashed password for a specific user in a virtual machine interactively
Code:
qm guest passwd vm_id username --crypted 1
Motivation: The motivation for using this use case is to set an already hashed password for a specific user in a virtual machine.
Explanation:
- ‘qm guest passwd’: This is the command to set the password for a specific user in a virtual machine.
- ‘vm_id’: This is the ID of the virtual machine for which the password needs to be set.
- ‘username’: This is the username for which the password needs to be set.
- ‘–crypted 1’: This argument indicates that the password provided is already hashed.
Example output:
Enter hashed guest password for user 'username':
Password changed successfully for user 'username' in virtual machine 'vm_id'.
Conclusion:
The ‘qm guest passwd’ command is useful for setting passwords for specific users in virtual machines managed by QEMU/KVM Virtual Machine Manager. It provides the flexibility to set passwords interactively or with already hashed passwords.