In the actual production environment, the root password should be kept strictly, if you forget the password. Of course, the root password has a corresponding backup, but if your backup is lost, or if the customer forgets the root password, and does not enter the system properly, then use GRUB to modify the kernel to change the password.
First of all, you have to press any key in the engine room when you start Linux, enter the Grub selection menu 650) this.width=650; "Src=" http://s5.51cto.com/wyfs02/M01/8B/35/ Wkiom1hgwtgyhcfbaah9nx3x7mu099.png-wh_500x0-wm_3-wmp_4-s_4128830202.png "title=" Grub selection Menu "alt=" Wkiom1hgwtgyhcfbaah9nx3x7mu099.png-wh_50 "/>
Click "E" here to select the latest kernel in your system (typically a machine with upgraded kernels) 650) this.width=650; "Src=" http://s4.51cto.com/wyfs02/M01/8B/36/ Wkiom1hgxpytjvt9aah99pkm1zk358.png-wh_500x0-wm_3-wmp_4-s_3733329262.png "title=" grub Menu "alt=" Wkiom1hgxpytjvt9aah99pkm1zk358.png-wh_50 "/>
In the instructions here, there are 5 keys:
B: Enter Boote: Enter the Grub Shell Edit Interface o: Add a line below the cursor line d: Delete the line where the cursor is located C: command-line interface into the GRUB shell
Here select kernel directly press "E" into the Grub Shell's edit interface input single650) this.width=650; "Src=" http://s1.51cto.com/wyfs02/M02/8B/33/ Wkiol1hgyegs5kdtaaipee7d2me607.png-wh_500x0-wm_3-wmp_4-s_347523687.png "title=" single "alt=" Wkiol1hgyegs5kdtaaipee7d2me607.png-wh_50 "/>
Enter save, and then press "B" boot into the single-user maintenance mode, the system will give you the root authority of a non-environment variable shell650) this.width=650; "Src=" http://s5.51cto.com/wyfs02/M01/8B/ 33/wkiol1hgyw_im97kaaa7owlhxp8006.png-wh_500x0-wm_3-wmp_4-s_321269514.png "title=" shell "alt=" without environment variables wKioL1hGyW_ Im97kaaa7owlhxp8006.png-wh_50 "/>
Execute passwd in the inside to modify your root password, and then reboot restart after the use of the new password, you have to say in the actual production environment must avoid the root password to forget the situation, if forget will be a more serious event.
This article from the "Technical essay" blog, reproduced please contact the author!
Forgot root password in Linux system