Applicable to:
- SolusVM
Question
How to change a root password of a root user for a KVM VM via CLI in SolusVM?
Answer
It should be done using the Linux native KVM functionality:
- Stop a VPS:
# virsh destroy kvmid - Find the location of its storage:
# virsh domblklist kvmid - Mount the storage:
# guestmount -a PATH -i --rw /mnt_tmp/ - Create hash of a new password:
# openssl passwd -6 -salt AbCdEfGh mypassword - Change permissions of shadow file in a mounted directory:
# chmod 755 /mnt_tmp/etc/shadow - Open shadow file with a text editor and replace a value of an existing password ( between first and second colons; <password> in my example below):
root:<password>:0:99999:7::: - Save changes and remove permissions from shadow file:
# chmod 000 /mnt_tmp/etc/shadow - Unmount the storage:
# umount /mnt_tmp/ - Boot the VPS and confirm that the password has changed:
# virsh start kvmid
Note: Replace kvmid respectively.
Note: Mounting directory /mnt_tmp/ is given as an example. Another mounting point could be used. Make sure it exists prior mounting.
Note: PATH is the path to a storage from the step 2. mypassword- is your new password
Note: A value after -salt (AbCdEfGh in this example) will define how secure the encryption will be. Make sure you define different values each time you manually changing a password.
For more information use the official RedHat documentation
Comments
Please sign in to leave a comment.