Password Recovery
This guide will show you how to recover a forgotten root password. A several methods are available that can help you accomplish this.
Contents |
Using a LiveCD
With a LiveCD a couple methods are available: change root and use the passwd command, or erase the password field entry. Any Linux capable LiveCD can be used, albeit to change root it must match your installed architecture type.
Change Root
- Boot the LiveCD, and change root.
- Use the
passwdcommand to reset your root password. - Exit change root.
- Reboot, and remember your password.
Using GRUB to Invoke Bash
1. Select the appropriate boot entry in the GRUB menu and press e to edit the line.
2. Select the kernel line and press e again to edit it.
3. Append init=/bin/bash at the end of line.
4. Press b to boot (this change is only temporary and will not be saved to your menu.lst). After booting you will be at the bash prompt.
5. Your root file system should be mounted as readonly so remount it as read/write:
# mount -n -o remount,rw /
6. Use the passwd command to create a new root password.
7. Reboot and do not lose your password again!
Countermeasures
An attacker could use the methods mentioned above to break into your system. No matter how secure the operating system is or how good passwords are, having physical access amounts to loading an alternate OS and exposing your data, unless you use full disk encryption.
Resources
- this guide for an example.