Centos7 cracking root password

Time:2020-1-4

1. Start up, select kernel and press e

 

2. Enter the following interface, change RO to RW init = / sysRoot / bin / Sh

 

 

 

3. Press Ctrl + X to enter a shell interface. You need to switch the root and use / sysRoot as the root

Input: chroot / sysRoot

 

4. Enter the passwd command to change the password. You need to enter it twice, one of which is to confirm the password

 

5. If the server SELinux is not shut down, you need to execute touch /. Autorelabel, otherwise the password will not take effect (skip this step if SELinux is shut down).

 

6. Click exit to exit the command

 

7. Enter reboot to restart the server or press Ctrl + Alt + delete to restart