root password reset - RHEL7













To reset root login password, reboot your machine.



When your Linux server is booting, you can able to see the kernel line then press e key


then replace the rhgb quiet with init=/bin/bash 


after replacing the string then press Ctrl+x to boot your Linux Server in single user mode


when you enter into the single user mode, your root file system will in read-only mode to change the your file system from read-only to re-write remount your file system with R/W

bash-4.2#mount |grep root
bash-4.2#mount -o remount,rw /



change your root password using 
bash-4.2#passwd
after changing the password if your reboot your machine without relabeling the SELinux it will not allow to login with changed password.
To relabel the SELinux enter the below command

bash-4.2#touch /.autorelabel

bash-4.2#exec /sbin/init

Your server will reboot, after successful reboot try with your new password. 

Enjoy....



Please write your valuable Comments .......



No comments:

Post a Comment