How Linux systems recover root Password summary

Source: Internet
Author: User

Instance 1-1 Modifying the Grub menu to enter single-user mode

1. How does CentOS enter the GRUB menu?

when Linux boots, press ENTER to enter the GRUB menu

650) this.width=650; "Src=" Http://s3.51cto.com/wyfs02/M00/8A/4F/wKiom1gtGSqzhB20AAAjP0UBmHo850.png-wh_500x0-wm_3 -wmp_4-s_1819631819.png "title=" 1.png "alt=" Wkiom1gtgsqzhb20aaajp0ubmho850.png-wh_50 "/>

2, Press the E key to edit, enter the GRUB Edit menu

650) this.width=650; "Src=" Http://s4.51cto.com/wyfs02/M01/8A/4B/wKioL1gtGQ6DB4z3AAAxJYqerUY663.png-wh_500x0-wm_3 -wmp_4-s_3983982214.png "title=" 2.png "alt=" Wkiol1gtgq6db4z3aaaxjyqeruy663.png-wh_50 "/>

3. Select kernel line, press the E key to edit, enter the edit line, add "Space single" or "Space init 1" At the end,then press ENTER to save exit, then press b Key Restart System

650) this.width=650; "Src=" Http://s4.51cto.com/wyfs02/M02/8A/4F/wKiom1gtGTyCkm0wAAAa92ZBLxM866.png-wh_500x0-wm_3 -wmp_4-s_4101848143.png "style=" Float:none; "title=" 3.png "alt=" Wkiom1gtgtyckm0waaaa92zblxm866.png-wh_50 "/>

650) this.width=650; "Src=" Http://s3.51cto.com/wyfs02/M01/8A/4F/wKiom1gtGT2g5Hu5AAAZd0GYwJk120.png-wh_500x0-wm_3 -wmp_4-s_944117056.png "style=" Float:none; "title=" 4.png "alt=" Wkiom1gtgt2g5hu5aaazd0gywjk120.png-wh_50 "/>

4, that is, enter the single user mode, enter passwd root to change the root password

650) this.width=650; "Src=" Http://s4.51cto.com/wyfs02/M02/8A/4C/wKioL1gtGVCj4h0AAAAc4tKmnmo857.png-wh_500x0-wm_3 -wmp_4-s_3033196659.png "title=" 5.png "alt=" Wkiol1gtgvcj4h0aaaac4tkmnmo857.png-wh_50 "/>

Example 1-2 Enter rescue mode with CD or ISO

1, boot into the BOIS interface, modify boot for CD- ROM drive, save modify restart

650) this.width=650; "Src=" Http://s1.51cto.com/wyfs02/M00/8A/4F/wKiom1gtGWTwbBkSAAAhKUD0KaE143.png-wh_500x0-wm_3 -wmp_4-s_134636356.png "title=" 6.png "alt=" Wkiom1gtgwtwbbksaaahkud0kae143.png-wh_50 "/>

2. Enter the Linux system installation interface and select Rescue installed system to enter rescue mode .

650) this.width=650; "Src=" Http://s2.51cto.com/wyfs02/M01/8A/4C/wKioL1gtGXLz_FlQAAJh7nttKu8232.png-wh_500x0-wm_3 -wmp_4-s_1055223065.png "title=" 7.png "alt=" Wkiol1gtgxlz_flqaajh7nttku8232.png-wh_50 "/>

Select language for English

650) this.width=650; "Src=" Http://s4.51cto.com/wyfs02/M01/8A/4F/wKiom1gtGYDx3RSJAAAmAUqpvmU994.png-wh_500x0-wm_3 -wmp_4-s_2268910752.png "title=" 8.png "alt=" Wkiom1gtgydx3rsjaaamauqpvmu994.png-wh_50 "/>

Select keyboard Type US

650) this.width=650; "Src=" Http://s5.51cto.com/wyfs02/M02/8A/4C/wKioL1gtGYzBi-3QAAAewavL0ms916.png-wh_500x0-wm_3 -wmp_4-s_1181936590.png "title=" 9.png "alt=" Wkiol1gtgyzbi-3qaaaewavl0ms916.png-wh_50 "/>

Choose not to start the network

650) this.width=650; "Src=" Http://s5.51cto.com/wyfs02/M01/8A/4F/wKiom1gtGZrjauBqAAAUXZYX8lk257.png-wh_500x0-wm_3 -wmp_4-s_203140235.png "title=" 10.png "alt=" Wkiom1gtgzrjaubqaaauxzyx8lk257.png-wh_50 "/>

Select Continue

650) this.width=650; "Src=" Http://s3.51cto.com/wyfs02/M02/8A/4C/wKioL1gtGbCgyuK6AABLgurPQmE956.png-wh_500x0-wm_3 -wmp_4-s_2219094601.png "title=" 11.png "alt=" Wkiol1gtgbcgyuk6aablgurpqme956.png-wh_50 "/>

remind the user which directory the system is mounted in, press OK Continue

650) this.width=650; "Src=" Http://s4.51cto.com/wyfs02/M01/8A/4C/wKioL1gtGb7y5DyXAAAiuWKoKv0094.png-wh_500x0-wm_3 -wmp_4-s_2951879196.png "title=" 12.png "alt=" Wkiol1gtgb7y5dyxaaaiuwkokv0094.png-wh_50 "/>

Select Shell Start Shell, press OK to continue entering

650) this.width=650; "Src=" Http://s5.51cto.com/wyfs02/M02/8A/4F/wKiom1gtGcuiwl6fAAAWoJIYdqA801.png-wh_500x0-wm_3 -wmp_4-s_3878475868.png "title=" 13.png "alt=" Wkiom1gtgcuiwl6faaawojiydqa801.png-wh_50 "/>

3, edit the/mnt/sysimage/etc/passwd file, press DW(delete a character), the root of the x(This is the user password) deleted, and then save the exit

650) this.width=650; "Src=" Http://s4.51cto.com/wyfs02/M02/8A/4C/wKioL1gtGdaga-zeAAADirDDF6s714.png-wh_500x0-wm_3 -wmp_4-s_2218105560.png "title=" 14.png "alt=" Wkiol1gtgdaga-zeaaadirddf6s714.png-wh_50 "/>

4, shutdown or restart into the BOIS, modify back to the local hard disk boot system

5, enter the user interface, at this time the root user does not have a password

650) this.width=650; "Src=" Http://s5.51cto.com/wyfs02/M00/8A/4C/wKioL1gtGezjMGyCAAAOIdohk38441.png-wh_500x0-wm_3 -wmp_4-s_113545634.png "title=" 15.png "alt=" Wkiol1gtgezjmgycaaaoidohk38441.png-wh_50 "/>

Instance 1-3 into rescue mode, using Chroot to enter the root mode of the system

1, the way to enter the rescue mode omitted

2, chroot/mnt/sysimage/

650) this.width=650; "Src=" Http://s2.51cto.com/wyfs02/M01/8A/4F/wKiom1gtGfqy_PGiAAAJcrPMJdg366.png-wh_500x0-wm_3 -wmp_4-s_208904337.png "title=" 16.png "alt=" Wkiom1gtgfqy_pgiaaajcrpmjdg366.png-wh_50 "/>

3. change The root password

650) this.width=650; "Src=" Http://s5.51cto.com/wyfs02/M01/8A/4C/wKioL1gtGgbSfufbAAAT1gzvS0M395.png-wh_500x0-wm_3 -wmp_4-s_1658908188.png "title=" 17.png "alt=" Wkiol1gtggbsfufbaaat1gzvs0m395.png-wh_50 "/>

4, because this command line, does not recognize the shutdown Restart command, directly unplug the machine to restart the system


This article is from the "Bin Less Technology blog" blog, please be sure to keep this source http://yinjianbin.blog.51cto.com/4529118/1873796

How Linux systems recover root Password summary

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.