What if you retrieve the root password you forgot when you use Lilo/grub?

Source: Internet
Author: User
Keywords Lilo
Tags change command line installation key linux linux command password press

What if you retrieve the root password you forgot when you use Lilo/grub?

1. In the system into a single user state, directly with passwd root to change;

2. With the installation CD-ROM boot system, into the Linux rescue State, the original/partition hook up, the order is as follows:

Cd/mnt
mkdir HD
Mount-t Auto/dev/hdax (the partition number of the original partition) HD
CD HD
Chroot./
passwd Root

This can be done;

3. Take down the hard drive of the machine and hang it on the other Linux system, using the same method as the second

Taking Rh8 as an example, the 1th method is shown below:

I. Lilo

1 Type Linux single in the presence of Lilo: prompt

Screen Display Lilo:linux single

2 to go directly to the Linux command line

3 Vi/etc/shadow

Deletes the first row, that is, the line that begins with Root: After and Next: the contents of the previous

The first row is similar to

Root:: ...

Save

4 reboot reboot with null root password

Two. Grub

1 in the presence of grub screen, use the up and down key to select the one you normally start Linux (do not choose Dos), and then press e key;

2 again with the up and down key to select the one you normally start Linux (similar to kernel/boot/vmlinuz-2.4.18-14 ro root=label=/), and then press e key;

3 Modify the command line you see now, add single, and the result is as follows:

Kernel/boot/vmlinuz-2.4.18-14 single RO root=label=/

4 return to the car, and then press the B key to start, you can go directly to the Linux command line

5 Vi/etc/shadow

Deletes the first row, that is, the line that begins with Root: After and Next: the contents of the previous

The first row is similar to

Root:: ...

Save

6 reboot reboot with null root password

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.