Red Hat/centos Root Password loss Solution

Source: Internet
Author: User
Tags password protection
Original http://linuxboy.org /? P = 52

Linuxboy uses centos as an Example

Directly Delete the root password

In Linux, the user name and password are stored separately, which correspond to the files/etc/passwd and/etc/shadow respectively. When you log on, read the/etc/passwd file first, and then read/etc/shadow to check whether the password of the currently logged on user is correct. This is the shadow passwords and MD5 password protection function used in Linux for password protection, that is, the shadow password.

In this way, in the/etc/passwd file, the password location is identified by "X.

In Linux resuce mode, we can delete the "X" password of the root user in the/etc/passwd file, so that the root user password is left blank and the root permission is obtained. The detailed steps are as follows:

1. boot the system with a CD, and press F5 in the startup option to select Linux rescue mode

2. Enter Linux rescue and press Enter.

3. Select the default language English and press Enter.

4. Select the default keyboard type us and press Enter.

5. Configure the network: Select No and press Enter.

6. Select continue and press Enter.

7. Run the command: chroot/mnt/sysimage to obtain the root permission. Press ENTER

8. Run: chroot/mnt/sysimage

9. Use VI to edit the/etc/passwd file, delete the password field corresponding to root, and save the disk and exit.

Okay, it's time to reboot. Try it. Do you have to enter the password as root.

Finally, I would like to welcome the blog www.linuxboy.org, which is commonly used in linuxboy!


========================================================== =
Red Hat/centos Root Password loss solution (1)

Linuxboy uses centos as an Example

1. Use passwd to reset the root password in single-user mode



Red Hat/centos Root Password loss solution (1)

Linuxboy uses centos as an Example

1. Use passwd to reset the root password in single-user mode

Linux can run in multiple modes. in single-user mode, you do not need to enter the password to enter the system. In this case, passwd is used to reset the root password. The procedure is as follows:

  1. When the system starts, press the Enter key to enter the system options menu interface. Press "E" to enter the menu editing status.

(Select the system to be started with the upper/lower marking key, press the Enter key to start the system directly, press the "e" key to edit the startup command, and press the "A" key to modify the startup parameters of the kernel, "C" Key To Go To The grub command line)

2. The command options available when the system is started are listed on the screen. Select "kernel" and press "E" to enter the command line editing status. Enter single after "", set the system to start in single-user mode, and press enter (Note: add space before single). Then you can press "B" to start the system.

(Press "B" to start the command line, press "O" to add a line under the selected command line, and press "D" to delete the selected line. ESC returns to the main menu)

3. After the system is successfully started, you can use passwd root to reset the root password.

Now you can reboot. Try logging on with a new password.

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.