|Picture by Freddie the Boy|
It happens to me every so often, that I have to do maintenance on a Linux box, and I’ve changed my passwords around and can’t remember the password I used on that particular box (or even the user name…). I always have to hunt around the net, hoping I find something, so I thought I’d capture it on my own blog:
- Reboot the computer
- At the GRUB or LILO prompt, press escape.
- Go to the line that would normally boot, and press e to edit
- Go to the end of the command line, and add rw init=/bin/bash to it
- Press Enter, then press b to boot
- You should now be entered into a passwordless root shell
- Either set your password with passwd <username>, or see a list of users with cat /etc/passwd.
- Reboot again
- Happy times!
Hope this helps me (and maybe some else) in the future…