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.
Reset the password with command
Update selinux information
Reboot your system