Resetting a forgotten CentOS root password
If you have forgotten the root password of your CentOS server, you can reset it from the server console like this:
-
When the GRUB screen appears during boot, press any key to stop the countdown.
-
Select the default boot entry and press e.
-
On the next screen, find the line that starts with
kerneland press e while it is selected. -
Go to the end of the line, add a space, type
singleand press Enter. You return to the previous screen. -
Press b and wait for the system to boot.
-
When the system drops to the
#prompt, type this command and press Enter:passwd root -
Enter your new root password.
-
Type this command and press Enter to restart the machine:
reboot