" "
spot_img
HomeSTORAGEHow to Change or Reset your forgotten root password...

How to Change or Reset your forgotten root password in RHEL?

Did you forget your RHEL Linux root password? Don’t worry, resetting a root password is not a difficult task. It can be completed in a few steps by accessing the kernel parameters from the GRUB boot loader. After that, log in with your new password.
Now, let us see the steps to change and reset the root password on RHEL:
Reset Forgotten Root Password in RHEL

First, reboot your system. At the boot GRUB menu, select the Kernel and press the ‘e’ key to interrupt the boot process.
After entering the Kernel boot parameter, go to the line that starts with Linux and press ctrl+e to go to the end of the line. Add the parameter rd.break at the end of the line and press ctrl+x to start.
Next, you will enter the Emergency Mode Prompt. Press Enter to proceed with the process in the shell prompt.
By default, the file system is mounted under the /sysroot directory in read-only (ro) mode. So, ensure to remount the /sysroot directory with read and write permission.

# mount | grep sysroot

Remount the /sysroot directory with read and write permissions, then confirm the permissions again.

# mount -o remount,rw /sysroot/
# mount | grep sysroot

After mounting the drive, enter the following command to make changes in the system files.

# chroot /sysroot

Now reset the root password with the following command:

# passwd

After changing the password, enable the SELinux relabeling process.

# touch /.autorelabel

At last to start the SELinux relabelling procedure, enter the exit, and log out.

Once finished, the system will reboot and ask you to log in as the root user with a new password, which usually takes a few minutes.
Change the Root Password in RHEL

Log on to the RHEL Server using SSH or Console.
Run the passwd command to change a password for the root user:

sudo passwd root
root@new:~$ sudo passwd root
New password:
Retype new password:
passwd: password updated successfully
root@new:~$

If you already have root access and want to change your existing root password, you can modify it with just the ‘passwd’ command.

root@new:~# passwd
New Password:
Retype new password:
passwd: password updated successfully
root@new:~#
4.To re-enable the root account, enter the command
sudo -i or su
Now, you have successfully changed or reset your root password in RHEL.
Hope this step helped to change or reset the forgotten root password. If you still need any assistance, feel free to Get Assistance.
Also check:
Steps to Install LibreNMS on CentOS 8 / RHEL 8
Steps to Fix “apt-get: command not found” error in Linux
To get more updates you can follow us on Facebook, Twitter, LinkedIn
Subscribe to get free blog content to your Inbox

- Advertisement -

- Advertisement -