How to Reset Root Password On CentOS 7

Retrieving your forgotten passwords for most of the websites is easy but Retrieving passwords of the 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 the remote machine.

Here we go!

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

Go to the line  number 16 and change ro with rw init=/sysroot/bin/sh

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

Access the system with this command.

chroot /sysroot

Reset the password with command

passwd

Update selinux information

touch /.autorelabel

Exit chroot

exit

Reboot your system

reboot -f

That’s it

Leave a Reply

Your email address will not be published. Required fields are marked *