How to recover/reset Root Password on CentOS 5 & 6

Booting to Grub Menu (press any Keys. Eg: ESC)

From the GRUB menu, select the appropriate kernel version and press the ‘e’ key.
You will now be presented with the option menu for the kernel version.

Highlight Kernel line and press the “e” key.

Now we need to add to the end of this line one o the following:
1, s, or single
And now press Enter to save your changes.

pic

Next select Kernel line and press the “b” key to boot to single mode.

And finally, type command “passwd” to change the root pass.

Note: The screen is black screen after press the “b” key to boot => append “nomodeset” option to boot.

Eg: <LE=us rd_NO_DM 1 nomodeset