How to Reset Forgotten Root Password in RHEL
If you’ve forgotten the root user password, don’t worry—resetting it is a straightforward process. Just follow these simple steps to set a new password, and you’ll be able to log in with your updated credentials in no time.
How to Reset Forgotten Root Password
First, restart your computer. When the GRUB menu appears during the boot process, select the kernel you want to boot into (usually the first option). Then, press the ‘e’ key on your keyboard to edit the boot parameters.

On the next screen, you will see a list of kernel boot parameters. Locate the line that begins with kernel=
and add the parameter rd.break
at the end of that line. Once you’ve made the change, press Ctrl + X
to proceed.
# rd.break

On the next screen, you will enter emergency mode. Here, press the Enter key to access the shell prompt. Once you’re in, ensure that you remount the sysroot directory with both read and write permissions.
# mount | grep sysroot

Now, remount the sysroot directory with read and write permissions and verify the permissions once more. This time, you’ll notice that the permissions have changed from “ro” (read-only) to “rw” (read and write), as shown.
# mount -o remount,rw /sysroot/
# mount | grep sysroot

Next, mount the root file system in read-write mode using the following command.
# chroot /sysroot
Next, use the passwd
command to reset the root password. Enter the new password and confirm it when prompted.
# passwd

At this point, you’ve successfully reset your root user password. Now, the final step is to relabel all files with the correct SELinux contexts.
# touch /.autorelabel

Finally, type “exit” and log out to begin the SELinux relabeling process.
# exit

This process usually takes a few minutes. Once it’s complete, the system will reboot and ask you to log in as the root user using your new password.
