Sometimes you forget stuff like meetings, seminars,passwords etc. I do. But forgetting a password to a Servers with no easy way to reset it while locked outRedhat servers is one of such systems. If you forget the root password to your RHEL 7 SERVERS, it’s almost virtually impossible to reset it while you’re locked out.
Here i Discuss an easy way to reset password in RHEL 7 servers or Centos 7
Interrupt the boot process in order to gain access to a system.for this press the arrow keys in keyboard
At the boot menu, press e to edit the existing kernel . Then, go to the kernel line (the line starting with linux16) .
Then add the statement rd.break at the end as shown below:
Then press Ctrl-x to start the boot process
Then mount the /sysroot/ in read/write mode. By default it mount as a read only mode.
Then execute the chroot command on the /sysroot partition
Now Change the root password by using the passwd command
Then execte the command as like below
Enjoy with new password.