SWS Technologies

Sep 26, 2024

Effective Root Password Recovery in RHEL 9

Compare init=/bin/bash and rd.break methods and learn the updated recovery flow.

Linux

Author: Karthi S

In RHEL systems, administrators can regain access by editing GRUB boot options and booting into a shell to reset the root password. RHEL 9 changes mean init=/bin/bash is often the more straightforward method compared to rd.break.

Updated RHEL 9 password reset process

  1. Press e to edit GRUB.
  2. Change ro to rw in the linux line.
  3. Append init=/bin/bash.
  4. Press Ctrl+x to boot.
  5. Run passwd to reset the password.
  6. Run touch /.autorelabel.
  7. Run exec /sbin/init.

Method A (init=/bin/bash)

  1. Grub → e
  2. init=/bin/bash (remove rhgb and quiet if necessary) → Ctrl+x
  3. /usr/sbin/load_policy -i
  4. mount -o remount,rw /
  5. passwd root
  6. mount -o remount,ro /

Method B (rd.break)

  1. Grub → e
  2. rd.breakCtrl+x
  3. mount -o remount,rw /sysroot/
  4. chroot /sysroot/
  5. passwd root
  6. touch /.autorelabel

These steps align with modern RHEL 9 boot and SELinux behavior.