Thursday, August 19, 2010

Forgot your password...! This is how you reset in Ubuntu.

It's a common case that when you have not used your Ubuntu machine for some time you may have forgotten your password.
If you want to reset a new password instead of your old one,
and don't want to loose any of your date this is the coolest way to do.

But for this your computer need to have a CD ROM and you need to have a Ubuntu Live CD with same(preferred) or fairly close version.

Step 1.
Insert the Live CD and boot the computer in the Live CD mode.

Step 2.
Open the terminal and change to the root user

sudo su

Step 3.
create a directory
e.g.
mkdir foo

Step 4.
Find your Linux partition.
e.g. using the command
fdisk -l

by this you will get all the partition in the computer, and by looking at them you can find out your Linux partition.
e.g.
Device    Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1       18710   150288043+  83  Linux
/dev/sda2           18711       19457     6000277+   5  Extended
/dev/sda5           18711       19457     6000246   82  Linux swap / Solaris

here the Linux partition is /dev/sda1

Step 5.
mount the partition the the newly created file.
e.g.
mount /dev/sda1 foo/


Step 6.
Use chroot to access the partition as its root
e.g.
chroot foo/

now you have all the root permission to the mounted hard-disk partition.

Step 7.
Use the file etc/shadow to find out the users of the system
e.g. if the user name is bar,
use the commands
passwd bar

to change user password
and
passwd root

to change the root password

that's it! all done.
Now restart the computer and login to the system with the new password.

1 comment:

  1. a given article is very interesting and very useful for me, and pardon me permission to share articles here hopefully helpful and useful
    Run4.co gswitch3.co Superfighters

    ReplyDelete