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

AI is killing cloud sustainability

You only need to look at the differences in power consumption between GPUs and CPUs. CPUs were fine for...

CMS Content Management System | websiteroof.com

What is CMS? Content Management System (CMS) is used to maintain web content, allowing multiple contributors to create, edit and...

What’s New in Node.js 22: Exciting Features and Updates

Node.js, the powerful and popular JavaScript runtime, has released its latest version—Node.js 22. In this release, three major updates...

CIO perspective and takeaways from WEF 2023 Davos

Credit: iStock by Getty Images The World Economic Forum (WEF) met last week in Davos, Switzerland for its annual conference....

Microsoft Azure Pricing in 2024 [Understanding Cloud Prices]

Why you can trust us407 Cloud Software Products and Services Tested3056 Annual Software Speed Tests2400 plus Hours Usability TestingOur...

The Way Your Website Looks Changes How Your Visitors Feel

When you visit a website for the first time, it probably doesn’t take you long to judge whether the...

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