Reset forgotten root password on linux boxes...

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!!

  1. Press Ctrl-Alt-Del to shut down the system in an orderly fashion.
  2. 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".
  3. 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=/
  4. 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.

  5. 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 /
  6. Now that the file-system is remounted read-write, go ahead and type `passwd` to change the root password.
    # passwd
  7. 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 /
  8. You can now safely press on the power button to shutdown the sytem.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

reset forgotten root password

nice one... i too had the same issue which i resolved it at http://hashprompt.blogspot.com

Comment