Resetting CentOS 5 Root Password

If you have forgotten the root password it is possible to set a new one as follows:

  1. Interrupt the boot at the GRUB stage and boot to runlevel 1, AKA single user mode.
  2. Interrupt GRUB by typing a character such as "space" then append to the kernel line by typing "a",
  3. backspacing through "rhgb quiet" and appending " 1<enter>".
  4. This will give you a root shell and not a login prompt. From there you can use the "passwd" command to set a new root password.

Other user passwords can be reset, and other administrative tasks can be performed as well. Exiting the single user root shell will boot to the multi-user mode defined in /etc/inittab.

Share

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.