EMAILHow to Change or Reset your forgotten root password...

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

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

  1. First, reboot your system. At the boot GRUB menu, select the Kernel and press the ‘e’ key to interrupt the boot process.
  2. 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.
  3. Next, you will enter the Emergency Mode Prompt. Press Enter to proceed with the process in the shell prompt.
  4. 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
  1. Remount the /sysroot directory with read and write permissions, then confirm the permissions again.
# mount -o remount,rw /sysroot/
# mount | grep sysroot
  1. After mounting the drive, enter the following command to make changes in the system files.
# chroot /sysroot
  1. Now reset the root password with the following command:
# passwd
  1. After changing the password, enable the SELinux relabeling process.
# touch /.autorelabel
  1. 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

  1. Log on to the RHEL Server using SSH or Console.
  2. 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:~$
  1. 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

Latest news

CrateDB 2.0 Adds Clustering Upgrades and SQL Enhancements to Its Database Solution for IoT and Machine Data – Cloud Computing Today

On May 16, Crate.io announced the availability of CrateDB 2.0, an open source SQL database that specializes in IoT...

10 Most Popular Web Hosting Control Panels in 2024

Looking for a web hosting control panel to host your website? We have compiled a list of top 10...

Enhancing Cloud Security with AWS Security Services

Cloud computing has become an operational pillar for businesses today. Major cloud service providers like Amazon AWS provide a...

Caring about Cloud Carbon Commitments: A Look at VMware’s Zero Carbon Committed Initiative

Ian Moyse, Industry Cloud Thought Leader & Sponsored Influencer of VMware’s Zero Carbon Committed Initiative Having worked in IT leadership...

Must read

Top 10 CIO Trends for 2019

As we get ready to close out 2018 and...

Are the cloud wars over or just getting started?

One of the biggest opportunities for enterprises large and...

You might also likeRELATED
Recommended to you