This is quick trick to reset forgotten root password .
Reboot the system.
Interrupt the boot at the GRUB stage(by pressing any key ) and boot to runlevel 1 i.e. Single usermode . For this select the kernel you want to boot, then use "e" or "a" to edit it .
In edit give space and then append "single". Hit Enter or "b" for boot. The system will boot in single user mode, then use "passwd" to reset password/s. e.g. #passwd root Other user passwords can be reset,
CentOS-6 Note: Due to an upstream SELinux bug the root password cannot be reset on a fresh install of CentOS-6 without an additional step. Booting with "selinux=0" appended to the grub kernel line are work-arounds.
Reboot the system.
Interrupt the boot at the GRUB stage(by pressing any key ) and boot to runlevel 1 i.e. Single usermode . For this select the kernel you want to boot, then use "e" or "a" to edit it .
In edit give space and then append "single". Hit Enter or "b" for boot. The system will boot in single user mode, then use "passwd" to reset password/s. e.g. #passwd root Other user passwords can be reset,
CentOS-6 Note: Due to an upstream SELinux bug the root password cannot be reset on a fresh install of CentOS-6 without an additional step. Booting with "selinux=0" appended to the grub kernel line are work-arounds.