Ubuntu forced to change the root password

 

Ubuntu forget super user root password and reset the password

 

Solutions are as follows:

 

The first method - do not enter the recovery mode settings (recommended)

 

Case Description: Ubuntu versions: Ubuntu 16.04.3 LTS

 

Step1: Start the system, during startup, repeatedly press the Esc key or shift key (I pro-test repeatedly press or press and can be, no need to tangle), until the following screen appears:

 

 

 

Step2: up and down keys to move through and select Advanced Options Ubuntu (or some version shows the Advanced options for Ubuntu), and then press the 'Enter' key to enter the following interface

 

 

 

Step3: Select Ubuntu, with Linux 4.13.0-38-generic (as follows:

 

 

 

Step4: Press the 'e' key, enter the following interface

 

 

 

Step5: By the arrow keys to move the cursor, to find the linux / boot / ....... ro recovery nomodeset line is located, as follows

 

 

 

Step6: The figures nomodeset ro recovery to quiet splash rw init = / bin /the following change End

 

 

 

STEP7: Press 'F10' key, after a few seconds, into the interface as follows:

 

 

 

Step8: Enter the command passwd, as follows

 

 

 

Step9: pressing the "Enter" key, the interface is as follows:

 

 

 

Step10: After entering the password and press "Enter" keyboard, press Enter, enter the password again, the interface is as follows

 

 

 

Step11: After input password twice, press the "Enter" key, the interface is as follows:

 

Enter your password success

 

Step12: restart the computer (if it is a virtual machine, the virtual machine restart), into the terminal, enter the command su - displays the following

 

 

 

Step13: password just set, the interface is as follows

 

$ # Goes, that is the superuser.

If there is no prompt authentication failure or any other error messages, you can also modify the password was successful.

Or whoami command to view the current user.

 

The second way - to enter recovery mode settings (not recommended)

 

If you forget the root password, enter the recovery mode can be reset.

Sudo command or when an error occurs, you can enter recovery mode repair / etc / sudoers file.

 

Set the following steps:

Step1: Start Ubuntu system, the process press the Shift key, enter the grub menu;

Step2: Select recovery MODE, press the "e" key to enter the edit; then select recovery mode (recovery mode), the transport;

Step3: to / etc directory permissions to modify sudoers: chmod 0440 sudoers, get; you can also add the root password at the same time, next time will not be too much trouble;

Step4:ctrl+x

Step5: Press ctrl + alt + del restart; or reboot;

 

 

 

reference:

Ubuntu forget super user root password, reset the password

Ubuntu recovery mode of entry and exit

Guess you like

Origin www.cnblogs.com/laosan007/p/11683735.html