Resetting a lost root password (RHEL / CentOS 6.x)

There are at least two methods to reset a lost root password on a server –

  1. Booting into single user mode.
  2. Using a boot USB, DVD or drive and editing or changing the /etc/passwd file.

Let’s try “booting into single user mode” –

  1. Boot Computer and Interrupt while booting at GRUB stage hitting ‘arrow‘ keys or “space bar“.
  2. Type ‘a‘ to modify kernel argument. Anytime you can cancel typing ‘ESC‘ key.
  3. Append 1 at the end of “rhgb quiet” and press “Enter” key to boot into single user mode.
  4. Type command “runlevel” to know the the runlevel where you are standing. Here “1 S” state that your are in a single user mode.
  5. Type ‘passwd‘ command without username and press ‘Enter‘ key in command prompt. It’ll ask to supply new root password and re-type the same password for confirmation.

Leave a comment