Connect with us

Hi, what are you looking for?


How to Reset Forgotten Root Password on RHEL 8 / CentOS 8

If you forget a root password of your RHEL 8 and CentOS 8 and want to reset the password so that the RHEL 8 and CentOS 8 based Linux distribution to run successfully with new password. When the root password is forgotten it so vital that you need to recover it without reinstalling the RHEL 8 and CentOS 8. During the recovery process you won’t able to access any documentation so it is recommended to write this commands separately on a piece of paper so that recovery process will complete successfully.
The steps are given below to recover the root password on RHEL 8 and CentOS 8:

  1. Select the Linux Kernel
  2. Edit the Linux kernel Parameters
  3. Recover the root password
  4. Auto Label the SELinux context to /etc/passwd file
  5. Boot with the graphical user interface target

Step-1 : Select the Linux Kernel

Press up and down key simultaneously so that you will access the GNU-GRUB2 menu. From the first option hit E to edit the first grub menu.

Step-2 : Edit the Linux kernel Parameters

After editing the GNU-GRUB2 menu find the lines started with linux16 and hit End button to go to the last line and add rd.break to it.
After add these lines hit Ctrl + X to boot.

Step-3 : Recover the root password

First mount the /sysroot directory

# mount -o rw,remount /sysroot

Then Change the root directory to /sysroot

Advertisement. Scroll to continue reading.
# chroot /sysroot

After that change the root password and you will be prompted to add the new password make sure it is strong.

# passwd root

Step-4 : Auto Label the SELinux context to /etc/passwd file

Finally after running the passwd command the Linux need to be set the new password by relabeling to the /etc/passwd file and it is necessary for running with correct SELinux context.

# touch /.autorelabel

It takes several minutes depending on your system CPU and Hard Drive speed.

Step-5 : Boot with the graphical user interface target

It is vital to run the Linux distribution with the graphical user interface by using the

Advertisement. Scroll to continue reading.
# systemctl set-default

When done type two times exit and exit command to exit from chroot jail and to reboot the system.


Congratulations, now you have recovered the root password. If need an assistance or help then you need to use the comment section below for more support and help.


You May Also Like


How to auto upgrade JioFi firmware for JioFi 2 / JioFi 3 / JioFi 4 / JioFi 5 / JioFi 6 and other JioFi...


Internet is the most important public network for connecting to the WEB. For internet connection requirement the ISP is required as well as it...


How to download and install the Mobile Intel 4 Series Express Chipset Graphics Drivers for Windows 10.  Windows 10 is the one of the...


How to Install and Configure PCSX2 on Windows 10. The Windows 10 is the most recommended operating system for the Games. In stream platform...