How to Reset/Recover Forgotten Root User Account Password
To Reset/Recover Forgotten Root User Account Password in RHEL/CentOS 7
Resetting/Recovering Forgotten Root User Account Password in RHEL/CentOS 7 is explained in this article. There are various ways to reset root password and we are going to follow “ Booting into single user mode” type to reset the password.
To try login using with Login Credentials
First let us try to login as root in the CentOS 7 server. If you have forgot your password then try logging in with the user credentials. Now we have logged in using the user1. It is not possible to change the password of the root from the user login.
To reset the password
Now boot into single user mode and reboot the Server, as soon as you see the below screen and then Press ' e' from keyboard.
After hitting ' e' from keyboard, you will get the display as shown below. 4
Search for the text rhgb quiet and replace it with init=/bin/bash
After editing press ' ctrl+x' and it will start booting with specified parameter. Now a bash prompt appears.
To change the root password
You should have read-write permission on root partition to change the root password.
bash-4.2# mount -o remount,rw /
Change the root password by typing the passwd command. Relabel SELinux context. If we skip relabeling the whole SELinux context we would be able to login using password.
bash-4.2# passwd root [Enter New Password] [Re-enter New Password] bash-4.2# touch /.autorelabel Reboot and login again to root account. bash-4.2# exec /sbin/init
Comments ( 0 )
No comments available