reset root password on Red Hat/Fedora/CentOS
Okay, so you’ve screwed the pooch and need to reset the password for root on your Red Hat/Fedora/CentOS installation. Assuming that it is a default installation, without hardening, this can be done fairly easily.
This assumes you have GRUB installed.
- When the GRUB login screen comes up, hit “e” to edit.
- Move the cursor down to the kernel line and hit “e” again.
- At the end of the kernel line, add a space and the word “single.” This will force the reboot into single user mode. Continue booting the server. You will automagically be logged in as root.
- Run the passwd command to reset root’s password.
- Reboot as normal.