Two ways to reset or change forgotten Root password on RHEL 6/CentOS 6 Systems

If you forgotten your root password for RHEL 6 and CentOS 6 systems don’t worry we are here to help you out on this.

Navigate to the following link if you want to reset forgotten root password on RHEL 7/CentOS 7.

This is generally happens when you use different password in a vast environment.

It can be done in many ways but we are going to show you the best two methods which we tried many times for our clients.

In Linux servers there are three different users are available. They are,

  • Normal User,
  • System User and
  • Super User.

As everyone knows the Root user is known as super user in Linux and Administrator is in Windows.

We can’t perform any major activity without root password so, make sure you should have the right root password when you perform any major tasks.

If you don’t know or don’t have it, try to reset using one of the below method.

  • Reset Forgotten Root Password By Booting into Single User Mode
  • Reset Forgotten Root Password By Booting into Rescue Mode

Method-1: Reset forgotten root password by booting into single user mode

This is easy and native method to reset the forgotten root password in RHEL 6/CentOS 6 systems. Just follow our instruction to do the password reset without any headache.

Step-1: Reboot your system and interrupt in boot screen by using any key from your keyboard to launch the GRUB Menu.

Step-2: In GRUB Menu, hit a key to modify the kernel arguments.

Step-3: Append S or single or 1 after a space at the end of the line and press Enter key to boot into single user mode.

Screenshot with S value.

Screenshot with 1 value.

Step-4: Once you hit Enter key then it will take to you into single user mode. Just type passwd command to reset the root user password. Finally reboot the system by issuing init 6 or shutdown -r now command.

Note: by default it will show you in the first line that you are in “Single User Mode” when you use 1 but it won’t show anything when you are get into single user mode with help of S or single. To double confirm this, you can run runlevel command to get the details.

Step-5: Now you can login to your system with your new password.

Method-2: Reset forgotten root password by booting into rescue mode

This method is bit complicated compared to previous method however, this method also helps you to reset the forgotten Root password for RHEL 6 and CentOS 6 systems.

Step-1: Insert the bootable media through USB or DVD drive which is compatible for you and reboot your system. It will take to you to the below screen. Hit Rescue installed system to launch the Rescue mode.

Step-2: Choose your preferred language.

Step-3: Choose the keyboard type.

Step-4: What type of Media Contains your Rescue Image? It won’t ask anything when you are using Virtual environment and It will prompt you if you use a physical system.

Step-5: Root password reset doesn’t require network services so, simple hit No.

Step-6: The rescue environment will now attempt to locate your Linux installation and mount it under the directory /mnt/sysimage. Just hit Continue.

Step-7: Your system has been mounted under /mnt/sysimage.

Hit Ok to start a shell.

Step-8: Select Start Shell and click Ok to launch a shell.

Currently your system is mounted in rescue mode is a temporary root partition. Check this with help of df -h command. Now, your command prompt shows bash-4.1#.

Step-9: Run the below command to mount your root partition of the file system used during normal user mode. After you ran this command, your command prompt changed to sh-4#.

Run the df -h command to confirm that your system is mounted properly.

Step-10: Just type passwd command to reset the root user password.

Step-11: Issue exit twice to exit from the rescue shell environments.

Step-12: Remove the bootable media then initiate the reboot.

Step-13: Finally choose the Reboot option in the screen and hit Ok to reboot the system.

Step-14: Now you can login to your system with your new password.

About Magesh Maruthamuthu

Love to play with all Linux distribution

View all posts by Magesh Maruthamuthu

3 Comments on “Two ways to reset or change forgotten Root password on RHEL 6/CentOS 6 Systems”

Leave a Reply

Your email address will not be published. Required fields are marked *