How to Reset Root Password On CentOS 7

Reset CentOS password

Reset CentOS password

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 line  number 16 and change rowith  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

READ NOW:- Top 3 ways to stop execution of a thread

Leave a Reply

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