Possible Duplicate:
Lost Root and other user passwords

I have a number of linux machines (debian and ubuntu) left from a former system administrator. There's no way to find out root passwords on those computers. How do I get root access without reinstalling linuxes?


Dedian and Ubuntu block the old "single user boot" method as this requires the root password too the way these distributions are configured.

If you have a user that has wide root privileges via sudo you might be able to set the passord with sudo passwd root though access to passwd like that is usually looked out in sudo configurations.

You other option is to boot from a live CD and reset the password from there. The process goes something like:

  1. boot from live CD, preferably one from the same distro that you are currenty using (though any should work)
  2. make sure you are logged in to the LiveCD setup as root
  3. mount your old root partition with mkdir /mnt/realroot then mount /dev/whererealrootis /mnt/oldroot - extra steps may be needed if you use RAID or LVM and the arrays/volumes are not detected automatically by the LiveCD.
  4. use chroot /mnt/realroot /bin/bash to create a shell that uses the machines usual root partition instead of its own
  5. change the password with passwd - the chroot step above means the "real" password will be changed, not the one on the LiveCD's setup
  6. you can now reboot and login as usual (if you are paranoid, exit out of the chroot shell and run sync and umount /mnt/realroot first.

There are also ways to blank the password manually (again, from a LiveCD) but using the chroot method is a little safer IMO.


You can reboot with inserting init=/bin/bash into the kernel parameters.

It will bring you a very simple system, which is not functioning at most, but you can still:

mount -o remount,rw /
passwd root
mount -o remount,ro /

In case even the boot loader is not capable to provide you CLI (eg lilo) or it's been restricted (password protected grub), you have to get a live cd, mount the drive, mount the root partition by hand, reset the password and reboot the system.

I am sure a lot of persons will advise getting a boot cd, so that part is not a problem.

You can always choose System Rescue CD for this (http://www.sysresccd.org/Main_Page)


Looks like it can be done but you will need to boot into single user mode. Further instructions can be found here

  • 1
    From the question linked above: "Booting in single user mode won't work for Debian and Ubuntu because you still have to enter the root password for maintenance mode." – Ignacio Vazquez-Abrams Jun 23 '10 at 8:20

Let me Google that for you.


First link nicely explains all the options. I would go for #2, which is "boot a Live Linux CD, mount your disk, edit the password file".

  • -1 That's not the point of serverfault, please read meta.stackexchange.com/questions/8724/… – Weboide Jun 23 '10 at 10:39
  • 2
    Hi. I voted you down, but wanted you to know why I burned the points. Answers like this are helpful for a day or a week, maybe, but they contribute absolutely nothing to the community. You don't even reiterate what the answer is, you just point to a number in a sequence that is likely to change over time. Next time, at least reiterate the answer (if it's different than the rest of the available answers here), and give credit (and a link) to the page you got it from. – Matt Simmons Jun 23 '10 at 10:42

Not the answer you're looking for? Browse other questions tagged or ask your own question.