What to do if you forget the root password of Ubuntu

In the Ubuntu 16.04 system, the administrator password is lost or invalid due to misoperation, and the root password is forgotten. At this time, no root/sudo privilege operations can be performed. You can reset the root password through GRUB and restore the administrator account to a normal state.

tool

• Ubuntu16.04 operating system

Reset root password

• Start the system, display the GRUB selection menu (long press the shift key), and enter the selection interface.

• Select (advanced settings) enter key 

Picture 1.png

 

• Boot to select advanced mode -> recovery mode (the newest one) -> root (directly press enter)

Picture 2.png

Picture 3.png

 

• Set the password as required. Manage passwords.

 Command: Passwd root # modify the password (the password modified here is not used)

Picture 4.png

 

• After modification, shut down and restart

• After re-entering the system, execute sudo passwd root to modify the password again. --The password is the new password

Picture 5.png

• carry out!

Guess you like

Origin blog.csdn.net/cz_00001/article/details/112350225