How to Reset Root Password On CentOS 7

Retrieving your forgotten passwords for most of the websites is easy but Retrieving passwords of system is almost impossible to reset. We must have RHEL/CentOS machine serial terminal access with boot menu options to reset the password. We can’t reset the root password if we’re connected with remote machine.

Follow the below procedure to recover a forgotten root password on RHEL/CentOS.

1. Reboot/Start the system, In the boot grub menu select option to edit type “e”

2. Go to the line of Linux 16 and change ro with rw init=/sysroot/bin/sh

3. Press Control+x to start the system in single user mode.

4. Access the system with this command.

chroot /sysroot

5 Reset the password with command.

passwd

6. Update selinux information

touch /.autorelabel

7. Exit chroot

exit

8. Reboot your system

reboot -f

That’s it

 

Comments are closed