Reset Forgotten Root Password
You can reset the root password in case you have forgotten it. For this we use boot options in grub. We will boot in runlevel 1 for this purpose. Runlevel 1 is Single User mode.
This assumes that you are running an official Centos graphical installation with grub. This guide should also be fully compatible with Fedora and RHEL.
Doing the work
- Restart your computer.
- When the grub options appear (the menu that lets you select multiple kernels, in case you have multiple kernels) press Escape key.
- When you press the Escape key you will reach in the kernel selection menu.
- Select the appropriate kernel you want to boot in and press ‘a’ (without quotes). You will have a prompt now. The prompt will be something like this.
grub append> ro root=LABEL=/ rhgb quiet
- Add ’1′ to that line. So the whole prompt line would look something like
grub append> ro root=LABEL=/ rhgb quiet 1
- Now let the computer boot. Once booted up, you will get a prompt like
- Enter passwd here. passwd is the command used to change the password for a user.
- The system will ask you for your new password, enter it twice and you are done.
- Reboot your machine and let it boot normally.
We test this stuff on our own machines, really we do. But you may
run into problems, if you do, come to #centos on irc.freenode.net