Ubuntu16.04 enter the maintenance mode to change the root password solution

After getting the virtual machine given by others, if we want to enter the system, but others have not told you the password, and there is no password for any user, what should we do?
After looking around, finally found a particularly simple and reliable method:
record:
first, restart the Ubuntu system in the virtual machine, during the boot process, press the "shift" key to enter the grub boot option mode, we press up and down Key to select recovey mode, **do not press the enter key, **press "e" to enter the edit mode, we have to edit the command line at startup, otherwise it will still let you enter the root password when you enter In edit mode, go down and
replace "ro recovery nomodeset" with "quiet splash rw init=/bin/bash".
Then, we press F10 and restart.
Then we enter the root maintenance mode without a password. At this time, you can passwd root and change the password.
After the modification, we can re-enter the system.
At this time, we also need to restore the previous startup mode:

sudo vim /etc/default/grub

Modify it according to the figure below.
Insert picture description here

Guess you like

Origin blog.csdn.net/poolooloo/article/details/107636333