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.
Requirements
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.
1grub append> ro root=LABEL=/ rhgb quiet - Add ‘1’ to that line. So the whole prompt line would look something like
1grub append> ro root=LABEL=/ rhgb quiet 1 - Now let the computer boot. Once booted up, you will get a prompt like
1sh-3.2# - Enter passwd here. passwd is the command used to change the password for a user.
1# passwd - The system will ask you for your new password, enter it twice and you are done.
- Reboot your machine and let it boot normally.
More Information
Disclaimer
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
Added Reading
- Rute Linux Tutorial: http://rute.2038bug.com/index.html.gz
- http://www.gnu.org/software/grub/manual/html_node/Invoking-grub-install.html
Last Modified: 22 Apr, 2020 at 16:35:11