RHEL Recover root Password: Difference between revisions

From UNIX Systems Administration
Jump to navigation Jump to search
No edit summary
No edit summary
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>'''"linux16"'''</tt>.
## Locate the line that reads <tt>'''"linux16"'''</tt>.
### Immediately following the <tt>'''"quiet"'''</tt> keyword append <tt>'''"rd.break"'''</tt>
# Continue the boot process.
## Press <tt>'''Ctrl-x'''</tt> to boot.
# The system will boot into emergency mode and the <tt>'''switch_root'''</tt> prompt will appear.
# Remount the <tt>'''/sysroot'''</tt> filesystem as <tt>'''rw'''</tt>.
## <tt>'''# mount -o remount,rw /sysroot'''</tt>
# chroot to the <tt>'''/sysroot'''</tt> filesystem.
## <tt>'''# chroot /sysroot'''</tt>
# Create a new password.
## <tt>'''# passwd'''</tt>
# Update the SELinux Security Context.
## <tt>'''touch /.autorelabel'''</tt>
# Exit the <tt>'''/sysroot'''</tt> chroot.
## <tt>'''# exit'''</tt>
# Exit emergency mode.
## <tt>'''# exit'''</tt>
== RHEL8 ==
# Reboot OS into emergency mode.
# During the GRUB2 countdown, Edit the first line by pressing <tt>'''"e"'''</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.

Revision as of 13:44, 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

  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