RHEL Recover root Password: Difference between revisions

From UNIX Systems Administration
Jump to navigation Jump to search
Line 4: Line 4:
# During the GRUB2 countdown, Edit the first line by pressing <tt>'''"e"'''</tt>.
# During the GRUB2 countdown, Edit the first line by pressing <tt>'''"e"'''</tt>.
## Locate the line that reads <tt>'''"linux"'''</tt>.
## Locate the line that reads <tt>'''"linux"'''</tt>.
### Immediately following the <tt>'''"quiet"'''</tt> keyword append <tt>'''"rd.break"'''</tt>
##: Immediately following the <tt>'''"quiet"'''</tt> keyword append <tt>'''"rd.break"'''</tt>
# Continue the boot process.
# Continue the boot process.
#: Press <tt>'''Ctrl-x'''</tt> to boot.
#: Press <tt>'''Ctrl-x'''</tt> to boot.
Line 15: Line 15:
#: <tt>'''# passwd'''</tt>
#: <tt>'''# passwd'''</tt>
# Update the SELinux Security Context.
# Update the SELinux Security Context.
#: <tt>'''touch /.autorelabel'''</tt>
#: <tt>'''# touch /.autorelabel'''</tt>
# Exit the <tt>'''/sysroot'''</tt> chroot.
# Exit the <tt>'''/sysroot'''</tt> chroot.
#: <tt>'''# exit'''</tt>
#: <tt>'''# exit'''</tt>

Revision as of 19:14, 2 April 2026

Red Hat Enterprise Linux

  1. Reboot OS into emergency mode.
  2. During the GRUB2 countdown, Edit the first line by pressing "e".
    1. Locate the line that reads "linux".
      Immediately following the "quiet" keyword append "rd.break"
  3. Continue the boot process.
    Press Ctrl-x to boot.
  4. The system will boot into emergency mode and the switch_root prompt will appear.
  5. Remount the /sysroot filesystem as rw.
    # mount -o remount,rw /sysroot
  6. chroot to the /sysroot filesystem.
    # chroot /sysroot
  7. Create a new password.
    # passwd
  8. Update the SELinux Security Context.
    # touch /.autorelabel
  9. Exit the /sysroot chroot.
    # exit
  10. Exit emergency mode.
    # exit

Further Reading

  1. RHEL7 Changing and resetting the root password
  2. RHEL8 Changing and resetting the root password
  3. RHEL9 Changing and resetting the root password