Reboot your Server, at the bootloader screen select the kernel you would like to boot it with (usually the latest one) and hit ‘e’
In the next screen, find the line that refers to the kernel
- For RHEL/CentOS 7, the line starts with ‘linux16’.
- For RHEL/Centos 8x, and Fedora the line starts with ‘linux’.
Add ‘rd.break‘ at the end of kernel line and press Ctrl-x
Now the server will boot into OS rescue mode
Now, remount root partition in read/write mode
#mount -o remount rw /sysroot
Next, switch to root directory
At this point you can change the root password
#passwd <enter> *<new password>* *<repeat new password>*
Next step is for SELinux to allow new file changes – such as password reset in our case.
This step will take some time to relabel, as it depends on filesystem size
Once complete, Exit Server
then, Restart server
Validate new password has been set on Server after reboot by logging in with root account.