How Linux fixes the system's root password

Source: Internet
Author: User

If you cannot log on to the system because you forgot the root password, try the following method to change the root password you forgot:

Method One:

1, reboot the system. When the system boots to the grub or lilo (now typically Grub) boot menu, locate the system's current boot entry (you can expand the hidden menu by the arrow key);

2, positioning the cursor on this option to press the letter "E" key to enter the guidance of the editing State;

3, this option has three lines of statements, please use the cursor to select the second line, that is, "Kernel" the beginning of the line;

4, in this line again press the letter "E" key to enter this line of editing state;

5, at the end of the line add a space, write the number 1, similar to this:

kernel/boot/vmlinuz-2.6.9-11.19 ro root=label=/1

6, after the modification, press the "enter" key back to the original interface;

7, press the letter "B" key to start the guide.

In this way, you can start Linux Single-user mode, a bit like the security mode of Windows, is to start only

The most basic systems, network services, system services, etc. are not started.

After the single user mode boot completes, there will be a # prompt indicating that you already have superuser privileges, and then

Execute command after:/usr/bin/passwd

The system should be prompted to enter the password, this password is not back, to ensure that the input is correct, back to

After the car, the system will ask to enter again, input requirements consistent, and then see the password to modify the success of the prompt.

Then type command init 3 to type in the character interface mode of the system (the system will change the run level again)

See login: Prompt, and try again if you can use root and just

Modified password login.

Method Two:

1. Insert the first piece of the system CD into the optical drive, reboot the system, boot successfully from the optical drive after boot:

Enter the Linux rescue carriage return.

2. Follow the bootstrapper and go down without having to configure the network. But ask whether the hand cable and mount the system partition when selected

"Yes", the system enters "#"

Prompt.

3, execute the command chroot/mnt/sysimage/(the default system will hang in the/mnt/sysimage/directory)

4, execute the command/usr/bin/passwd to modify the root password.

5, execute the command exit; , remove the disc and reboot the system.

Then log on to the system with a new password.

Can complete the root password repair.

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.