Reference from http://www.cnblogs.com/zero527/p/6904966.html
1. Single-user mode
The first step:
Grub boot screen reads seconds by pressing the UP and DOWN ARROW keys to enter the Grub interface
Step Two:
Use the up and down cursor keys to select the operating system boot kernel you want to modify (by default), press the E key to edit
Step Three:
Use the up and down cursor keys to select "linux16 ..." line, delete rhgb quiet, press end to move to end of line, add parameter init=/bin/sh at the end to tell Grub to pass parameters to the operating system when starting this operating system. Press CTRL + X to reboot.
Fourth Step:
Normal access to the following interface
Enter the following command to reset the user password
If the system has SELinux enabled, you need to run the Touch/.autorelabel command, or the system may not boot properly
Run the command exec/sbin/init to start normally, or restart with the command exec/sbin/reboot.
The restart process is slow because the system is re-refreshing the SELinux security label.
2. Rescue mode
The first step:
Configure BIOS boot entry, use disc for first boot, press F10 to save exit
Step Two:
Read the second process select troubleshooting Enter
Then select Rescue a CentOS system to enter rescue mode
Step Three:
Read the tips and select continue to continue
Fourth Step:
Remember the chroot/mnt/sysimage command, then always click OK to continue
Fifth Step:
Enter the CD system, enter the Chroot/mnt/sysimage command to mount the local hard disk's operating system, change the password
Then exit the hard disk operating system, reboot reboot the system, and enter the BIOS set the hard disk as the first boot entry, into the hard disk system can
Linux hack root password