I've been through a similar situation on 1 of my systems.
The simplest way to recover from a lost password is to boot into single user mode.
If you are using LILO, at the LILO boot prompt (graphical LILO users can press Ctrl-x to exit the graphical screen and go to the boot: prompt), enter:
This will make you the "root" user without asking for a password. Once the system has booted, you can change the root password using the password command:
Using GRUB, you can manually edit the proposed menu entry at boot time. To do so, when GRUB is presenting the menu list (you might need to press ESC first), follow those instructions:
* use the arrows to select the single-mode boot entry (if you have it)
* press e to edit the entry
* use the arrows to go to kernel line
* press e to edit this entry
* at the end of the line add the word
init=/bin/bash
* press ESC to go back to the parent menu
* press b to boot this kernel
You should be in a root shell shortly.
You'll have to remount your / partition as writable.
Do:
Code:
mount -n -o remount,rw /
Now, open up /etc/shadow with a text editor like nano or vim and remove the hash your root account has.
Example:
root:$1$aB7mx0Licb$CTbs2RQrfPHkz5Vna0.fnz8H68tB.:10852:0:99999:7:::
will become:
root::10852:0:99999:7:::