CentOS 7 enters single user and cracks Root password

After installing the system, many students forget the root password. That is because they ignored the following two steps during installation. The password was set, but they were simply forgotten! If you haven’t remembered the password yet, continue~

1. Press the "e" key when entering the grub booter during system startup.

 2. 2. Find the line for Linux 16 and change ro to rw init=/sysroot/bin/sh

 The modified picture is as follows:

 Special tip: "\" after ro and rw does not exist, it just means that this line has not ended and the next line continues.

3. After modification, press Ctrl+x to enter single-user mode, as shown below:

 4. Carry out the following operations

 

1) Change the reference root directory and access the system directory.

chroot /sysroot

2) Reset password

    passwd root

    Enter the password twice in the blank space

3) Update system information

    touch /.autorelabel

4) Exit chroot

    exit

5. Restart the system

    reboot

Restarting the system may be slow, or it may restart multiple times, and finally, it’s time to log in with a new password!

Guess you like

Origin blog.csdn.net/m0_46517962/article/details/129763781