Thursday, January 17, 2019

How to recover a root password in linux RHEL 7 | How to reset a root password in Linux | Forget root password in RHEL 7

How to recover a root password
How to reset a root password
Forget root password




In this post we will learn how to recover a root password in RHEL 7 system. If you forgot your root password then this post will help you to recover or reset the root password. Please follow all steps as shown as below. Hope it will work for you. 


Note: Here in this post I have added all the things that I tested in my system. It worked for me when I forgot my root password. 

 

Step:01
=========
Press e on your keyboard when booting starting



Step:02
========
Use your arrow keys to move to the Linux16 line




Step:03
=======
Using your del key or your backspace key, remove rhgb quiet and replace with the following:

rd.break enforcing=0






Step:04
=======
Press Ctrl-x to start.




Step:05
=======
Remount the hard drive with read-write access:

# mount –o remount,rw /sysroot

 

Step:06
=======
Run chroot to access the system:

# chroot /sysroot

 

Step:07
=======
You can now change the root password:

# passwd

 

Step:08
=======
Type the new root password twice when prompted. If you are successful, you should see a message that reads "all authentication tokens updated successfully."

 

Type exit twice to reboot the system.

 


Step:09
=======
Log in as root and restore the SELinux label to the /etc/shadow file.

# restorecon -v /etc/shadow

Turn SELinux back to enforcing mode:

# setenforce 1



Done.

 

You can find me on Fiverr & LinkedIn

No comments:

Post a Comment