What to do with Linux forgetting the root password, and grub encryption

Source: Internet
Author: User


What about forgetting the root password with Linux? Restart the host before the physical host into single-user mode and change the password.



First, enter the single-user mode,


1. Restart the machine, press any key in the interface


650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/5B/24/wKioL1UAdIfDgvGhAAFzz5LzcRo206.jpg "title=" 5.png " alt= "Wkiol1uadifdgvghaafzz5lzcro206.jpg"/>


2, in the interface by E (this case to grub encryption, you need to press p after entering the password)


650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/5B/2A/wKiom1UAcBbw56ZHAAILkDey7C4535.jpg "style=" float: none; "title=" 1.png "alt=" Wkiom1uacbbw56zhaailkdey7c4535.jpg "/>


3, such as the interface, move the cursor to the second option, press E


650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/5B/24/wKioL1UAcTXBfMWxAAKm-m7lkt4462.jpg "style=" float: none; "title=" 2.png "alt=" Wkiol1uactxbfmwxaakm-m7lkt4462.jpg "/>


4, such as, at the end of the input 1 or S or single, return to the return, press B to boot to enter one-user mode.


650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/5B/24/wKioL1UAclbAXGG3AAInhm8pCtg056.jpg "title=" 3.png " alt= "Wkiol1uaclbaxgg3aainhm8pctg056.jpg"/>


Second, change the root password, directly passwd and enter the new password.

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/5B/24/wKioL1UAc3Lwix9eAAHqS9Kx2Hc078.jpg "title=" 4.png " alt= "Wkiol1uac3lwix9eaahqs9kx2hc078.jpg"/>


Third, for the Grub encryption, prevent others from touching the physical host after easy to modify the root password.

Configure the grub plaintext password, modify the Grub file, add password lines.

[Email protected] ~]# vi/etc/grub.conf [[email protected] ~]# cat/etc/grub.conf | Grep-v ^# | Head-5 # View first 5 lines non # start file default=0timeout=5password 123456 # Add password splashimage= (hd0,0)/grub/splash.xpm.gzhiddenmenu[[em AIL protected] ~]#

Configure the Grub ciphertext password, Grub-md5-crypt first, and then modify the configuration file.

[Email protected] ~]# grub-md5-cryptpassword:retype Password: $1$ppq/9$0onwm6l.6oz7y3daujckp0 #加密后的密码 [[Email Protected] ~]# vim/etc/grub.conf [[email protected] ~]# cat/etc/grub.conf | Grep-v ^# | Head-5default=0timeout=5password--md5 $1$ppq/9$0onwm6l.6oz7y3daujckp0 #添加密文splashimage = (hd0,0)/grub/ Splash.xpm.gzhiddenmenu[[email protected] ~]#




What to do with Linux forgetting the root password, and grub encryption

Related Article

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.