How to Reset Forgotten Root Password in RHEL 8

In this guide, you will learn how to reset a forgotten root password on RHEL 8 server. Resetting the root password usually involves a few steps that will help you to reset the root password and you will thereafter be able to log in using the new root password.

Related Read: How to Reset Forgotten Root Password in CentOS 8

So let’s dive in..

Reset Forgotten root Password in RHEL 8

First, boot into your RHEL 8 system and select the kernel you wish to boot into. Next, interrupt the booting process by pressing ‘e’ on your keyboard.

RHEL 8 Boot Menu

RHEL 8 Boot Menu

On the next screen, locate that begins with kernel= and append the parameter rd.break and press Ctrl + x.

Append Kernel Parameter

Append Kernel Parameter

On the next screen, ensure that you remount the sysroot directory with read and write permissions. By default, it is mounted with read-only access rights indicated as ro.

You can confirm this by running the command:

:/# mount | grep sysroot
Confirm Sysroot Directory Permissions

Confirm Sysroot Directory Permissions

Now remount the directory with read and write access.

:/# mount -o remount,rw /sysroot/

Once again, confirm the access rights. Note that this time, the access rights have changed from ro (read-only) to rw (read and write).

:/# mount | grep sysroot
Confirm Directory Permissions

Confirm Directory Permissions

Next, run the command shown to mount the root file system in read and write mode.

:/# chroot /sysroot

Next, use the passwd command to reset the password. As usual, provide a new password and confirm it.

# passwd
Reset Root Password

Reset Root Password

At this moment you have successfully reset your password. The only part remaining is to enable file system relabelling. To do this execute:

:/# touch /.autorelabel
Enable File System Relabelling

Enable File System Relabelling

Finally, type exit and then log out to begin the relabelling process.

SELinux Relabelling Process

SELinux Relabelling Process

This usually takes a couple of minutes and once done, the system will reboot upon which you can log in as the root user with the new password.

Reboot RHEL System

Reboot RHEL System

And that’s how you would reset a forgotten root password in RHEL 8.

If You Appreciate What We Do Here On TecMint, You Should Consider:

TecMint is the fastest growing and most trusted community site for any kind of Linux Articles, Guides and Books on the web. Millions of people visit TecMint! to search or browse the thousands of published articles available FREELY to all.

If you like what you are reading, please consider buying us a coffee ( or 2 ) as a token of appreciation.

Support Us

We are thankful for your never ending support.

James Kiarie

This is James, a certified Linux administrator and a tech enthusiast who loves keeping in touch with emerging trends in the tech world. When I'm not running commands on the terminal, I'm taking listening to some cool music. taking a casual stroll or watching a nice movie.

Your name can also be listed here. Got a tip? Submit it here to become an TecMint author.

RedHat RHCE and RHCSA Certification Book
Linux Foundation LFCS and LFCE Certification Preparation Guide
The Complete Linux System Administrator Bundle
Become an Ethical Hacker Bonus Bundle

You may also like...

Got something to say? Join the discussion.

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.