RHEL Recover root Password: Difference between revisions

From UNIX Systems Administration
Jump to navigation Jump to search
No edit summary
No edit summary
Line 43: Line 43:


== Further Reading ==
== Further Reading ==
# [https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/system_administrators_guide/ch-working_with_the_grub_2_boot_loader#sec-Changing_and_Resetting_the_Root_Password RHEL7 Changing root Password]
# [https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html/configuring_basic_system_settings/changing-and-resetting-the-root-password-from-the-command-line_configuring-basic-system-settings#resetting-the-forgotten-root-password-on-boot_changing-and-resetting-the-root-password-from-the-command-line RHEL8 Changing root Password]
# [https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/9/html/configuring_basic_system_settings/changing-and-resetting-the-root-password-from-the-command-line_configuring-basic-system-settings RHEL9 Changing root Password]


[[Category:Linux]]
[[Category:Linux]]

Revision as of 13:55, 19 September 2023

RHEL7

  1. Reboot OS into emergency mode.
  2. During the GRUB2 countdown, Edit the first line by pressing "e".
    1. Locate the line that reads "linux16".
      1. Immediately following the "quiet" keyword append "rd.break"
  3. Continue the boot process.
    1. 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.
    1. # mount -o remount,rw /sysroot
  6. chroot to the /sysroot filesystem.
    1. # chroot /sysroot
  7. Create a new password.
    1. # passwd
  8. Update the SELinux Security Context.
    1. touch /.autorelabel
  9. Exit the /sysroot chroot.
    1. # exit
  10. Exit emergency mode.
    1. # exit

RHEL8/RHEL9

  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".
      1. Immediately following the "quiet" keyword append "rd.break"
  3. Continue the boot process.
    1. 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.
    1. # mount -o remount,rw /sysroot
  6. chroot to the /sysroot filesystem.
    1. # chroot /sysroot
  7. Create a new password.
    1. # passwd
  8. Update the SELinux Security Context.
    1. touch /.autorelabel
  9. Exit the /sysroot chroot.
    1. # exit
  10. Exit emergency mode.
    1. # exit

Further Reading

  1. RHEL7 Changing root Password
  2. RHEL8 Changing root Password
  3. RHEL9 Changing root Password