recovering password in ubuntu

By | 26th October 2008

There are two ways to do it short way and a long way i will discribe both of them.

short way

If you forgot your password for your ubuntu system or any other GNU/Linux OS you can recover using the following steps

Turn your computer on.

Press ESC at the grub prompt.

Press e for edit.

Highlight the line that begins kernel ………, press e

Go to the very end of the line, add rw init=/bin/bash

press enter, then press b to boot your system.

Your system will boot up to a passwordless root shell.

Type in passwd username.

Long way

Recovering Password in Ubuntu or any GNU/Linux OS.
Step 1

We need to boot into a live cd. for this we can use ubuntu LiveCD or DVD. Place a live CD or DVD in the drive and boot into the system.

Step 2

Open a terminal which you can find in Applications -> Accessories -> Terminal.

Step 3

Type the following commands.

$sudo su     (Do not type the ‘$’ it is called as prompt. you need to type all the words after the ‘$’)

#gparted

(here the partition table will show all the partitions that are there on the hard disk. we need to check out the partition which has its filesystem as ‘ext3’ and make a note of it. Please check the screenshot).

#mount /dev/sda4 /mnt/ (enter the hardisk name and partition number in place of sda4 if its hda3 or sda8 we need to replace sda4 with the appropriate name and number)

Then enter the following set of commands.
#mount -t /proc/ none /mnt/proc
#mount –bind /dev/ /mnt/dev/
#chroot /mnt
#passwd
Enter new unix password:    ( here we have to give the new password).

and then restart the system.

the partition on which password is there

the partition on which password is there