I lost the root password for a guest system.
I mounted the guest system and changed it to single user mode. Then I used virsh
console to access the guest system, which was now in single user mode, and used a command echo "root":"123456" | chpasswd
to reset the password.
However, after the guest system rebooted, I couldn't access it. The new password was incorrect (Login incorrect
). However, if I mount the guest system again in host, and call chroot
, I verified that the new password was working by switching to a regular account, and switching back to root and entered the new password.
Both the server version and guest version of OS are the latest centos version.