Using Red Hat / CentOS etc one method of resetting the root user password is to boot into single user mode. To do so, interrupt the booting process if necessary so that you see the Grub boot menu:
Press the ‘e‘ keyboard button to edit the boot parameters. You will see a menu with the kernel line and the ram disk image. Choose the kernel line and again press the ‘e‘ keyboard button to edit the kernel boot parameters:
On the kernel boot parameters line add the word single to the end of the line as shown below, then press [Enter]:
To boot the machine with the ‘single’ modification press the ‘b‘ on the keyboard.
After booting you should be at the prompt as the root user. Enter the ‘passwd‘ command to set the root user password as shown below:
Then reboot the machine. The normal boot procedure will take the machine to the boot prompt where you can log in as the root user using the password you previously set.