Last Updated on 3 weeks by Sachin G
Forgetting the root password on a Linux server feels like locking yourself out of your own house — except this “house” is a mission-critical system. Over the last decade, working as a Linux system administrator, I have been asked countless times:
- “How to recover root password in Linux Red Hat 9?”
- “How to recover root password in Linux Red Hat 10?”
The good news is that resetting the root password in Red Hat Enterprise Linux 9 and 10 (RHEL 9 / RHEL 10) is not only possible but also straightforward if you know the right steps.
Changes in RHEL 9 and RHEL 10
With Red Hat Enterprise Linux / CentOS, we’ve seen many changes over the years — one of the biggest being the switch to GRUB 2. In older releases like RHEL 5 and RHEL 6, admins often used the single-user mode method to reset the root password. But with RHEL 9 and RHEL 10, the procedure is different due to GRUB 2 and enhanced security features like SELinux.
Why You May Need to Reset the Root Password
You might need to reset the root password in RHEL 9 or RHEL 10 if:
- You’ve forgotten it
- It was changed by someone else
- It was stolen or compromised
In any of these cases, you won’t be able to log in or make critical changes to your system. Don’t worry — with just a few steps, you can reset the password and regain full access to your Linux system.
What This Guide Covers
In this tutorial, I’ll walk you through:
- The single-user mode method (adapted for GRUB 2)
- Methods to reset root password in RHEL 9 and RHEL 10
- Exact commands and screenshots
- Troubleshooting tips for GRUB and SELinux issues
- FAQs answering common sysadmin questions like “How to reset forgotten root password in RHEL 9 and RHEL 10?”
⚠️ Warning: Use this procedure carefully. A small mistake can make your machine unstable. Always test first on a non-production system before applying changes to live servers.
Why Root Password Recovery in RHEL Matters
The root account in Linux is the superuser — it controls package installation, user management, firewall settings, services, and pretty much everything else.
If you forget it on a production server, you can’t:
- Restart critical services.
- Add new users or fix permissions.
- Apply urgent security patches.
That’s why knowing how to reset forgotten root password in RedHat Linux is a must-have skill for any sysadmin, whether you’re working with physical servers, VMs, or cloud environments
Showing Forget root password and Reboot the system
Here, I am showing the screen while I try to log in through the GUI on a Linux system. The root login fails in the GUI, but I can perform the same action using the command line.

Method to Reset Root Password on RHEL 10 Single-User Mode
RHEL 10 follows a slightly different sequence. Apart from the systemd.unit=rescue.target
method, you can also use the init=/bin/bash trick:
In GRUB, press e
.
On the kernel line, append:
init=/bin/bash

Boot.
Remount the root filesystem:
mount -o remount,rw /
Run:
passwd root
Followed by checking the SELinux status, which is disabled. When the system tries to boot with SELinux enabled, the login process will be denied access to the /etc/shadow file because of this incorrect label, and you will not be able to log in. To fix this, you must tell the system to relabel the files on the next boot. This is done by creating a hidden file named .autorelabel
in the root directory.
touch /.autorelabel
And end command exec /sbin/init
is used in this specific recovery scenario to terminate the current shell (the temporary root shell) and force the kernel to proceed with the normal system initialization process.

Method to Reset Root Password in RHEL 9 Single-User Mode
Booting into Single-User Mode
In this version of GRUB, we will use single-user mode in rescue mode. In GRUB2, we have the Rescue Mode/Emergency Mode in the the new version, which makes it perfect for password recovery.
Steps to Reset Root Password on RHEL 9
Restart the system and hold down the Shift or Esc key (depending on your system) right after the BIOS/UEFI screen to access the GRUB menu. On some systems, the GRUB menu may appear automatically.
- Restart the server.
- At GRUB, press
e
to edit boot parameters. - On the kernel line, append:

rd.break

Boot with Ctrl+X.
The system stops at an emergency shell.
Remount sysroot with write permissions:
mount -o remount,rw /sysroot
chroot /sysroot
Now reset the root password:
passwd root
Update SELinux contexts:
touch /.autorelabel
exit
exit
reboot
This step prepares the system to boot into single-user mode in RHEL 9 for password recovery.
This is the standard reset root password RHEL 10 single-user mode procedure.
Method: How to Recover Root Password in Linux Red Hat via Rescue Mode
If GRUB is locked with a password or you don’t have console access, Rescue Mode is your friend.
Steps:
- Boot from the RHEL installation DVD/ISO.
- At the boot menu, choose:
Troubleshooting → Rescue a Red Hat system
- Once in the rescue environment, run:
chroot /mnt/sysimage passwd root
- Exit and reboot.
This is often the only option for cloud servers where GRUB is inaccessible.
I have got the root screen. 🙂 .

Troubleshooting: SELinux & GRUB Issues
- If you forget to run
touch /.autorelabel
after resetting the password in RHEL 10, SELinux may prevent logins. - If GRUB is password-protected, you’ll need installation media to boot into rescue mode.
- If
passwd
fails, make sure/sysroot
is mounted with write access.
FAQ Section
A: Not possible if you’re fully locked out. Only works if you have a sudo-enabled user.
A: Use GRUB with rd.break
or init=/bin/bash
to drop into an emergency shell and reset it.
A: Boot into single-user or rescue mode and run passwd root
.
Best Practices After Resetting Root Password
- Change the root password to a strong, unique one immediately.
- Create a secondary sudo admin user as a backup.
- Document credentials securely (use a password manager).
- Limit physical and console access to trusted staff only.
Learn Smarter. Level Up Faster →
Want to master Linux, DevOps, Ansible, or Cloud workflows the smart way? I’ve curated a list of top-rated, real-world Udemy courses — based on student reviews and practical feedback.
Visit the Recommended Courses page to explore and enroll in courses trusted by the community.
See Curated Courses →Forgetting the root password isn’t the end of the world. Whether it’s RHEL 9 or RHEL 10, you now know multiple ways to reset it: single-user mode, GRUB, rescue mode, or even through sudo if available.

I’m Sachin Gupta — a freelance IT support specialist and founder of techtransit.org. I’m certified in Linux, Ansible, OpenShift (Red Hat), cPanel, and ITIL, with over 15 years of hands-on experience. I create beginner-friendly Linux tutorials, help with Ansible automation, and offer IT support on platforms like Upwork, Freelancer, and PeoplePerHour. Follow Tech Transit for practical tips, hosting guides, and real-world Linux expertise!