[root@rhce-ryanrudolf]# rm -rf / 2> /dev/null

things I break/fix for fun and learning

Jan 4, 2018 - 1 minute read - Comments

How to Recover ROOT Password in RedHat Enterprise Linux 7

ROOT is the superuser / admin account on Linux systems. There are times wherein an admin needs to recover the root password due to compromised system, or simply because the password is very complex it is hard to remember! I’ve seen several ways on how to recover root password on several Linux system - Debian, Ubuntu, Fedora, CentOS, etc etc. But by studying the LinuxAcademy RHCSA course, it looks like the RedHat way is the easiest and straightforward way!


To be able to simulate this, I have setup a vmware image of RHEL7 on my study laptop. My study laptop has enough resources to smoothly run several VMs (2nd-gen core i5, 16GB ram and SSD storage).

  1. grub bootloader, press e to edit

  2. look for the linux16 line and append rd.break at the end of the line

  3. press ctrl-x to boot the system into initramfs shell

  4. remount sysroot as read/write, perform chroot, perform passwd to change the password, and finally touch autorelabel for SELinux

  5. once done, reboot and use the new root password!

Like this page? Share it!