In my PC, Linux is already installed and I forgot the password. I want to recover my Linux system password. How can I do it, step by step?

4 Answers 4


There is no way to recover a password.

You can boot a different installation (e.g. from DVD), mount the partition with /etc/shadow and clear the password (set it to the empty string). You can also try to run a password cracker on the file if you really need to know what it was.

  • 2
    +1 for the recovery vs reset distinction, though i think in this case the OP really wanted access to the system rather than actually "recovering" as such.
    – Sirex
    Sep 14, 2010 at 10:15
  • @Sirex: Will be interesting to see which, if ANY answer gets accepted. :-)
    – hotei
    Sep 14, 2010 at 16:09

init=/bin/bash is by far NOT the easiest way to do this. Boot into single user mode.

From the boot loader, instead of init=/bin/bash, just add the word "single" (without quotes).

The system will boot up as usual but drop you to a Bash prompt never asking you for a password and already having mounted the system as rw. Then reset your password with the passwd command.

When you're done run

init 3  

for CLI startup


init 5 

for GUI.

No mounting, remounting, rebooting, booting from live CDs or distributions are needed when done.

  • 3
    Many linux distro do ask for the root password when you boot single. It depends on the settings in /etc/inittab, I think the 'secure'/'unsecure' line.
    – lorenzog
    Sep 16, 2010 at 12:35
  • -1, ditto to @lorenzog's comment
    – Kimvais
    Feb 8, 2012 at 9:05

Your system password? Do you mean the root password?

Assuming you still have your password and you are in the sudoer list, you can set a new root password by running passwd as root. Something like

sudo passwd
  • this is the easiest way if the user is in the sudoers list. It should get more upvotes.
    – wullxz
    Nov 19, 2011 at 10:48

Fastest way is to pass the parameter init=/bin/bash to the boot loader (see an example here). That would give you a root console pretty much immediately, now mount -a and mount -o remount,rw / to get access to the system. Finally, a passwd command should allow you to set the root password.

Second option (since nowadays linux distro need a ramdisk with drivers when they start) is to boot with a live distro, then mount your linux partition somewhere (a-la mount /dev/sda1 /mnt), mount also /proc and /dev (devfs usually) into the new partition (mount --bind /proc /mnt/proc and mount --bind /dev /mnt/dev). Finally, chroot /mnt and mount -a should give you your system back. Now, sometimes live distro see your hard disk as sd (the old SCSI mapper, now used for SATA disks), so you might end up with /dev/hda mapped to /dev/sda. That were the case you need to mount by hand all that you find in your /mnt/etc/fstab file. Once that's done you can try the chroot again, and then passwd.

If you find this complicated learn the lesson: (1) don't use root (2) don't use root (3) use sudo

  • +1 since this is a method that works on linuxes that have broken the single user mode.
    – Kimvais
    Feb 8, 2012 at 9:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy