Linux Changes the root password in single-user mode
1 centos boot Press any key Enter the system Configuration Interface Guide diagram, notice in " " e key to enter Grub boot system editing interface.
650) this.width=650; "Src=" https://s2.51cto.com/wyfs02/M02/A6/F2/wKioL1neC7uzviMmAAAlwg7nNcE912.png-wh_500x0-wm_ 3-wmp_4-s_805820876.png "title=" 20171011202332.png "alt=" Wkiol1nec7uzvimmaaalwg7nnce912.png-wh_50 "/>
(1)Linux Operating System Configuration Guide interface diagram
Add:
In the/boot/grub/grub.conf file,the title field, each title field represents an operating system configuration option.
If there are multiple title fields, multiple operating system options are displayed.
650) this.width=650; "Src=" https://s4.51cto.com/wyfs02/M00/A7/17/wKioL1ngcVTwCoSDAADZPU-Bf0o431.png-wh_500x0-wm_ 3-wmp_4-s_600312307.png "title=" 20171011202409.png "style=" Float:none; "alt=" Wkiol1ngcvtwcosdaadzpu-bf0o431.png-wh_50 "/>
boot/grub/grub.conf file Content map
2, enter The Grub boot System editing interface, select the second kernel (kernel), note the following "E,to Edit the seleted command in theboot sequence" (the option to edit commands in the boot order), then press the e Key, Enter the editing interface for the boot sequence.
650) this.width=650; "Src=" https://s5.51cto.com/wyfs02/M00/A7/17/wKioL1ngcVTSt0qeAAA7xUBq-28309.png-wh_500x0-wm_ 3-wmp_4-s_1932369361.png "title=" 20171011202426.png "style=" Float:none; "alt=" Wkiol1ngcvtst0qeaaa7xubq-28309.png-wh_50 "/>
Grub Boot Configuration diagram
3, for example, after quiet Press the space bar and then edit "1" or single , which means to enter the RunLevel 1 , which is single-user mode, single means "individual". Then press ENTER to return to the grub boot configuration diagram.
650) this.width=650; "Src=" https://s5.51cto.com/wyfs02/M00/08/60/wKiom1ngdArR3sLrAAAYp-s3jQM634.png-wh_500x0-wm_ 3-wmp_4-s_307111294.png "title=" 20171011202448.png "style=" Float:none; "alt=" Wkiom1ngdarr3slraaayp-s3jqm634.png-wh_50 "/>
Grub Boot sequence edit diagram
4, in the grub Boot configuration diagram, note the following "pressB to boot ", pressing the b key to restart, into the single-user mode
650) this.width=650; "Src=" https://s5.51cto.com/wyfs02/M01/08/60/wKiom1ngdAvgffFHAAAzjtxptLc533.png-wh_500x0-wm_ 3-wmp_4-s_3406877715.png "title=" 20171011202511.png "style=" Float:none; "alt=" Wkiom1ngdavgfffhaaazjtxptlc533.png-wh_50 "/>
Grub Boot Configuration diagram
5. Single-user mode starts the system quickly, single-user mode does not start any services, and does not need to enter the root password, you can directly into the root user, at this time we can pass passwd command to reset our Root the user's password.
650) this.width=650; "Src=" https://s5.51cto.com/wyfs02/M01/A7/17/wKioL1ngcVTjPhWfAAAoDNItnaU957.png-wh_500x0-wm_ 3-wmp_4-s_3429042631.png "title=" 20171011202535.png "style=" Float:none; "alt=" Wkiol1ngcvtjphwfaaaodnitnau957.png-wh_50 "/>
Single-user mode command line
6. Change root password, enter command:passwd Root, successfully change root password, then reboot reboot .
650) this.width=650; "Src=" https://s5.51cto.com/wyfs02/M01/08/60/wKiom1ngdAuxhr6TAAAUiRC8vAQ578.png-wh_500x0-wm_ 3-wmp_4-s_3275846150.png "title=" 20171011202552.png "style=" Float:none; "alt=" Wkiom1ngdauxhr6taaauirc8vaq578.png-wh_50 "/>
This allows you to modify root by entering the Grub boot interface with parameter 1 or single in the kernel parameter . 's password.
However, such a system is not a loophole, others know that this method can enter the system. password protection is then added to the grub boot layer by MD5 encryption for Grub .
1. generate ciphertext for passwords with "grub-md5-crypt" command
650) this.width=650; "Src=" https://s5.51cto.com/wyfs02/M01/A7/17/wKioL1ngcVXDzS9IAAARPKPL47w668.png-wh_500x0-wm_ 3-wmp_4-s_3636503521.png "title=" 20171011202614.png "style=" Float:none; "alt=" Wkiol1ngcvxdzs9iaaarpkpl47w668.png-wh_50 "/>
2. Add encrypted ciphertext to the/boot/grub/grub.conf configuration file
650) this.width=650; "Src=" https://s2.51cto.com/wyfs02/M02/08/60/wKiom1ngdAzRsy1OAAEPc0OdQ9o014.png-wh_500x0-wm_ 3-wmp_4-s_76014039.png "title=" 20171011202631.png "style=" Float:none; "alt=" Wkiom1ngdazrsy1oaaepc0odq9o014.png-wh _50 "/>
3, boot and then enter the system boot configuration diagram, is not the same, press the p key to enter the password before the line.
650) this.width=650; "Src=" https://s5.51cto.com/wyfs02/M02/A7/17/wKioL1ngcVaydzI-AAAkG5FOPpg086.png-wh_500x0-wm_ 3-wmp_4-s_2428119099.png "title=" 20171011202647.png "style=" Float:none; "alt=" Wkiol1ngcvaydzi-aaakg5foppg086.png-wh_50 "/>
Linux user mode and runlevel one meaning
Seven user modes
0: shutdown,1: Single-user mode,2 Multi-user mode without network support,
3: Multi-user mode withnetwork support 4: Reserved,5: multiuser mode with x-windows Network
6: Reboot the system
Linux system Change password in single-user mode