I have done something that I thought that I would never have done. I forgot the root password on a CentOS server/workstation.
I don't know if I just had my hands on the wrong keys where I was typing the password or what but I forgot it.
Luckily, there is a way to reset this lost password.
First, you will need console access to the server, meaning, you will need to be physically sitting or standing in front of the server and have physical access to it. SSH remote access will not work.
Next, reboot the server/workstation.
Now, once it is starting to boot backup, you need to interrupt the boot at the GRUB stage (The first count down after you push the power button) by pressing a key like the space bar.
Next, press the "a" key, this will bring you to a command line with a command pre-typed for you. On the line that is there, remove (backspace) the "rhgb quiet" and add a "1" and then press enter.
This will boot into the root shell and NOT a login prompt. This is a single user mode.
From here you can enter the passwd command and reset the password. You can also reset other users passwords and do other administrative tasks.
Once you are done, reboot the server and let it boot normally.
*Note: If you are using CentOS 6 and have SELinux enabled, you will need to do either 1 of 2 things; add "selinux=0" in addition to the "1" from above or issue a "setenforce 0" command after you login and before resetting the password.