I had an old computer with linux installed and had forgotten the root password for it. Unfortunately, I did not have my favourite handy-dany knoppix cd around but did remember that I could get a shell access by appending "init=/bin/bash" to the lilo/grub boot loader, which should be enough to get in and reset the root password.
DISCLAIMER -- I do not take any responsibility for your actions if you go and try this on your friends machine!!
- Press Ctrl-Alt-Del to shut down the system in an orderly fashion.
- Reboot the system and when lilo/grub boot loader get to the point where you select the various installed kernels on the system, type the letter "a" for "append".
-
You will get a prompt like this to add boot options to the boot string found in your lilo/grub conf file:
grub append> ro root=LABEL=/
-
Append "init=/bin/bash" to it to look like this.
grub append> ro root=LABEL=/ init=/bin/bash
This tells the kernel to drop to a root prompt bash shell instead of starting the "/sbin/init" process.
-
The root filesystem is currently mounted read only which needs to be changed to read/write prior to resetting the password.
# mount -o remount,rw /
-
Now that the file-system is remounted read-write, go ahead and type `passwd` to change the root password.
# passwd
-
Since "init" isn't running to safely take down the system, remount the system to read only prior to shutting down the system.
# mount -o remount,ro /
- You can now safely press on the power button to shutdown the sytem.
- wizap's blog
- Login or register to post comments
Comments
nice one... i too had the same issue which i resolved it at http://hashprompt.blogspot.com