Sometimes you may need to reset root password in RHEL/CentOS/Fedora Linux because you forgot password or for security purposes. In this article, we will look at how to reset root password in RHEL/CentOS/Fedora Linux. If you have an active account with sudo privileges you can easily do this with the following command
$ sudo passwd root
You will be asked for new password and confirmation. However, if you don’t have sudo access for local user then follow the steps below to change root password via GRUB boot menu.
How to Reset Root Password in RHEL/CentOS/Fedora Linux
Here are the steps to reset root password in RHEL/CentOS/Fedora.
1. Boot RHEL/CentOS/Fedora
Boot/Reboot your RHEL/Fedora/CentOS Linux. When you see the boot process, press ‘e’ key to interrupt boot process and load the boot menu.
![](https://fedingo.com/wp-content/uploads/2021/08/reset-rhel-8-root-password-from-grub-01.png)
You will be able to see kernel parameters that you need to modify to reset root password. Here are the default parameters.
![](https://fedingo.com/wp-content/uploads/2021/08/reset-rhel-8-root-password-from-grub-02.png)
Navigate your cursor to the line starting with ‘linux…’ and press ctrl+e to edit it. Navigate your cursor to ‘ro crash’ and replace it with ‘ro break’ as shown below. This is a very important step so please do it very carefully.
![](https://fedingo.com/wp-content/uploads/2021/08/reset-rhel-8-root-password-from-grub-03.png)
Check the above change to ensure that it is correct. Only then press Ctrl+X to start your system.
![](https://fedingo.com/wp-content/uploads/2021/08/reset-rhel-8-root-password-from-grub-04.png)
You will be taken to a shell, where you need to remount your disk in read-write mode, with the following command.
mount -o remount,rw /sysroot
Change to sysroot folder to reset root password.
chroot /sysroot
Reset root password with passwd command.
passwd
You will be asked for new password and confirmation. Once you have reset password just enable relabeling on reboot and exit console.
touch /.autorelabel exit exit
Here’s a summary of the past steps.
![](https://fedingo.com/wp-content/uploads/2021/08/reset-rhel-8-root-password-from-grub-05.png)
The system will resume normal boot and prompt you for username and password.
![](https://fedingo.com/wp-content/uploads/2021/08/reset-rhel-8-root-password-from-grub-07.png)
That’s it. You have successfully reset root password in RHEL/CentOS/Fedora Linux. The key step in all this is to carefully edit kernel parameter from ‘ro crash’ to ‘ro break’, and switching to /sysroot folder after remounting disk.
The above steps can be used to reset password on most RHEL versions. As you can see, it is a little complicated so it is advisable to create a local user with sudo privileges to be able to easily reset root password, without having to change kernel parameters, as it can make the system unstable, if not done properly.
Also read:
How to Use Auto Indent in VI Editor
How to Setup LogAnalyzer with Rsyslog and MySQL
How to Setup Rsyslog with MySQL
How to Upload & Download Files from FTP in Linux
How to Delete Files Older Than X Days in Linux
Related posts:
![](https://fedingo.com/wp-content/uploads/2024/05/db908c05ad732bd197c1eaad1c6675d2.jpeg)
Sreeram has more than 10 years of experience in web development, Python, Linux, SQL and database programming.