Solution after the root password is forgotten
If you forget the root password, you can reset the root password locally by entering the single-user mode as follows:
After the instance is started, the grub Startup menu is automatically displayed,
650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M01/49/C6/wKioL1QaVRXgsLdNAAI5w3vfo0w698.jpg "Title =" 1.png" alt = "wkiol1qavrxgsldnaai5w3vfo0w698.jpg"/>
Method 1: Press "a" to enter the single-user mode.
This is the quickest way to enter the single-user mode. Use the "A" operation button in the grub Startup menu to edit the Kernel Parameter, enter a space at the end of the line, enter Single or 1, and press Enter.
650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M02/49/C4/wKiom1QaVSGyxKg9AAEIDhbAcUU036.jpg "Title =" 2.png" alt = "wkiom1qavsgyxkg9aaeidhbacu036.jpg"/>
Method 2: Press "E" to enter the single-user mode.
Use the "e" operation button in the grub Startup menu to go to The centos Startup menu interface, move the cursor to a line of "kernel" configuration items, and then press "E" to edit the "kernel" menu items, enter a space at the end of the line, enter single, and press enter to return to the Start menu selection page. Then, press "B" based on the screen prompts to start the system with the menu options you just edited.
When you enter the single-user mode, the system does not require password verification and directly obtains the root permission.
650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M00/49/C6/wKioL1QaVUvTYLKNAAF-tXJrMso509.jpg "Title =" 3.png" alt = "wKioL1QaVUvTYLKNAAF-tXJrMso509.jpg"/>
There is a key piece of information during the startup process:
Remountingroot filesystem in read-write mode: [OK]
This means that the root directory of the system has the read and modify permissions, so that we can use commands to perform some operations, such as resetting the root password, managing partitions and backing up data.
The following describes how to reset the root password:
Enter the passwd command and press Enter. At this time, the system will prompt you to enter a new password. Enter the new password and press Enter. Then you need to enter the new password again. Then press enter to change the password.
650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M00/49/C5/wKiom1QaVUSj9VNRAAGaKu3WyUQ488.jpg "Title =" 4.png" alt = "wkiom1qavusj9vnraagaku3wyuq488.jpg"/>
Then enter the reboot command to restart the system. After the system starts up, you can log on with the password you just modified.
This article is from the "Bing Lincheng" blog, please be sure to keep this source http://308107405.blog.51cto.com/6396647/1554663
Solution after the root password is forgotten