Changing/ Recovering root user password in RHEL7/ Cent OS 7
We are going to see How to Changing/ Recovering root user password in RHEL7/ CentOS 7 in this post
Boot the system and wait for GRUB menu. On some Operating systems, you need to disturb the booting by pressing any keys in your system.
Highlight the first line which is pointing the Operating System entry like showed in the above image and press “e” key in your keyboard to edit manually.
Then will get the below screen.
Using up/down, left/right arrow keys move the cursor to the “rhgb quiet” which is in kernel line starting with “linux16”
Using delete/backspace keys manually delete “rhgb quiet” entry and append “init=/bin/bash” entry like below.
Than press Ctrl+x to reboot your OS with specified option. Once rebooted, will get a shell prompt without credentials.
check whether the root filesystem has been mounted or not.
Mount the root filesystem with RW permission.
Now issue the “passwd” command to recover/change the root password. It will ask for the new password and re-enter the password for confirmation. Once provided the new password will receive the “Authentication token successfully updated”
Relabel the SELinux content using below command.
Restart the machine using the below command.
Finally, we recovered the root password. Now will restart the machine and login with a new root password.