Linux Tip: Single user mode
Recover root password
If you have ever forgotten the root password for any of your machines you know what a hassle it can be. If you have direct access to the machine and it is using the Grub boot loader it is very easy to change the password.
All you need to do is reboot the machine. When you are presented with the Grub menu, hit the 'e' key. This will allow you to edit the current boot options. Add the ' single' to the line that begins with 'kernel /vmlinuz'. Now press 'b' to boot with the modified boot options.
You'll now be presented with the command line. At the command line simply enter 'passwd'. You'll be prompted, twice, for a new password.
Type in 'exit' and the machine will continue booting into the normal process. Your root password has now been changed.
