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

Magento 2 Invoice: Overview & Setup Guide

In the growing world of ecommerce, invoices play a crucial role in maintaining financial transparency, recording transactions, and...

TMDHosting Review | Web Hosting Sun

TMD Hosting – lightning fast web hosting using SSD drives.The FTC Disclosure: We only review products and services that...

NFV (Network Functions Virtualization) – Cloudwithease

Cloud based networking replaces network hardware appliances with virtual machines. The virtual machines used as hypervisor run networking software...

Silvio Di Benedetto – How to migrate Veeam Backup database to PostgreSQL

Questo articolo è disponibile anche in lingua italiana, al seguente link – Veeam Backup: migrazione da SQL a PostgreSQL...

5 Reasons You Should Pick WordPress for Your eCommerce Site 

Of all the websites online across the entire globe, WordPress is the Content Management System (CMS) which powers a full...

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