How do I change the Virtual Machine root password in single-user mode?
Cause
If the administrator has forgotten the Virtual Machine root password and QGA is not installed (preventing an online password change), you must enter single-user mode to change the root password manually.
Solution
-
Open the Virtual Machine console. On the GRUB boot menu, position the cursor on the first entry and press e to enter edit mode.
-
Position the cursor after
.UTF-8and appendinit=/bin/shon the same line after.UTF-8. Ensure correct spacing. -
Press Ctrl+x to boot.
-
After booting successfully, run
mount -o remount,rw /to mount the root directory. -
Run
passwdto reset the password. -
Run
exec /sbin/initorexec /sbin/rebootto exit single-user mode. -
Restart the Virtual Machine and log in to the operating system with the new password.