Reset forgotten root password for centOS
Step 1 – Reboot your machine.
During the boot process, you will have a couple of seconds to interrupt the startup process. [screenshot]
Step 2 – Select your boot Kernel. [screenshot]
Step 3 – Choose the line that starts the systems Kernel and press ‘E’ to edit. [screenshot]
Step 4 – Insert the number 1 to the end of the line.
This will then force the OS to boot into ‘single-user’ mode. Editing the kernel from the grub is only a temporary change, the number 1 will be not be present the next time you boot up the system. [screenshot]
Step 5 – Press the ESC key when you have added the number 1.
Step 6 – Press ‘B’ to boot into the system.
Step 7 – Once you have booted back into the system, you will be logged in as root.
Step 8 – To change the password type the command ‘passwd’ follow the on screen instructions to set a new password.