How to reset the root password when CentOS forgets the password?

Time:2021-3-24

When using Linux system, the root password is a key security mechanism. But if you lose your root password that day, the problem is serious. Here’s how to solve the problem of forgetting the CentOS – root password.

1. Restart the system. When you start the system, you can see the boot directory. Use the up and down arrow keys to select the system where you forget the password, and then press “e”.

2. Select the second key – kernel, and then continue to press “e”

3. Enter after rhgb quiet, enter single or 1, and then enter

4. Then press enter to return to the interface, and then press B to reboot the system

5. After startup, we found that we can enter the system directly without entering the account and password

6. After entering, we can change the password according to passwd root

matters needing attention:

1. Machine restart boot system, to prevent skipping boot, it is recommended to keep pressing the letter “e”.

2. Select the kernel entry with “kernel”.

3. Please pay attention to the English prompt information of “B, e, C” letters below when guiding editing items.