Home / RHEL7 / How to reset the root password on RHEL 7 ?

How to reset the root password on RHEL 7 ?

This article will help you to reset the root password on Redhat enterprise Linux 7 (If you have lost it).  Unlike the previous  version of RHEL releases , REHL 7 brought special attention by bringing the lot of new features  on it.  You need to follow some special instruction on Redhat Enterprise Linux 7 to break the root password since SE-Linux is enabled by default. In RHEL 6 , if you start the system in runlevel 1 , you will get the root prompt to reset the root user password.

Here we will see that how we can recover the lost root password on RHEL 7.

1. Reboot the system .

2. In the grub menu, press escape key to prevent the system from booting. Edit the grub menu by pressing “e” .

RHEL 7  - Reset root password
RHEL 7 – Reset root password

3.Press the arrow keys to get the “linux16” line and press “end” key. This will take you to the end of the line. Here add ” rd.break  console=tty1 ”  like below. Press control-x to boot the system.

Edit the grub menu
Edit the grub menu

4.You will get the “switch-root” prompt like below.

Emergency mode RHEL 7
Emergency mode RHEL 7

5. When you boot the system using “rd.break” ,  system will be directly mounted on /sysroot in read-only mode. Let me remount it in read/write mode.

switch_root:/# mount -o remount,rw /sysroot

6. Switch into a chroot jail, where /sysroot is treated as the root of the filesystem tree.

switch_root:/# chroot /sysroot

7.Set the new root password. (please update the CMDB immediately !)

sh-4.2# passwd root
New password: 
Retype new password:
passwd:all authentication tokens updated successfully.

8.By default, SE-Linux will be enabled on RHEL7 . So create a blank file in the name of “.autorelabel” under root.

sh-4.2# touch /.autorelabel

9. Exit from the chroot jail and exit from the initramfs.

10 . System will reboot and perform a full SELinux relabel , then  reboot again.

11. once the system is rebooted, you will be able to login with new root password which you have set it .

Hope this article is informative to you .

Share it !  Comment it !  Be Sociable !!!.



  1. Thank You, this was of good help to me. Good One !!

  2. Excellent!!
    By the time i nearly made up my mind to destroy the partition and reinstall a fresh OS. This helps me a lot. Thank you very much!!!

  3. easy and simple way to reset root password

  4. Excellent – your awesome – Thanks!


    Simple for a first time user!! Helped me & excited to see it working! Thank you!

  6. Great….it worked perfect for me. Thank you for sharing the info

  7. great help for resetting root password.

  8. Super Lingesh, It’s worked fine.

  9. Clear guidance. Thank you!

  10. Phone Myint MYat Zaw

    Thank u sir….
    Be graceful !!!!!!!