Subscribe to How-To Geek

Reset Your Ubuntu Password Easily from the Live CD

Our last article on how to reset your Ubuntu password easily through the grub menu was quite popular, so I’ve decided to make a series on all the different ways to reset your password on either Linux or Windows… today’s lesson is how to use the Live CD to reset the password.

Note that we’ll also cover how to protect yourself against somebody else resetting your password, so stay tuned!

image

Of course, this method will also work if you’ve installed your Ubuntu Live CD to a thumb drive.

Resetting the Password

You’ll want to boot from your Ubuntu Live CD, choosing “Try Ubuntu without any change to your computer” from the boot menu.

image

Once the system boots, open up a new Terminal window from Applications \ Accessories and then type in the following command:

sudo fdisk -l

This command is used to tell what device name the hard drive is using, which in most cases should be /dev/sda1, but could be different on your system.

image

Now you’ll need to create a directory to mount the hard drive on. Since we’re actually booting off the live cd, the directory doesn’t really get created anywhere.

sudo mkdir /media/sda1

The next command will mount the hard drive in the /media/sda1 folder.

sudo mount /dev/sda1 /media/sda1

Now it’s time for the command that actually does the magic: chroot. This command is used to open up a shell with a different root directory than the current shell is using, and we’ll pass in the folder where we mounted the hard drive.

sudo chroot /media/sda1

Now you should be able to use the passwd command to change your user account’s password, and it will be applied to the hard drive since we are using chroot.

passwd geek

Note that you’ll have to type your username after the passwd command in order to change the right password.

image

Now you should be able to reboot your system and log yourself in with your new password.

The Geek is the founder of How-To Geek and a geek enthusiast. This article was written on 09/25/08 and tagged with: Linux

Daily Email Updates

You can get our how-to articles in your inbox each day for free. Just enter your name and email below:


Name:
Email:
Similar Articles Featured Wiki Articles
Latest Software Reviews Quick Linux Tips
Geek Arcade Popular Forum Threads

Comments (9)

  1. abhishekluck

    I have only disk with vista loaded.

    suppose if forget the password then will this method work for resetting the vista passwd ??

    abhi

  2. The Geek

    This article has nothing to do with Vista.

  3. poweruser

    For resetting the passwords on Windows you can use the Ophcrack LiveCD. I used to it reset the password on my parents XP computer. While not positive, I think it works for most versions of Vista. Be responsible with it!

  4. brundle

    Great article, I just put a dual-boot Ubuntu on a 1GB Vista laptop rather than spend Ł30 on another GB of memory. I’d be a total convert if I didn’t have to use Windows for work. This kind of information is just one of those `need to know` things that is bound to come in useful.

    Re: the previous comment(s) there is a specific version of Ophcrack for Vista. It manages passwords a little differently to 2000/XP (much much harder to crack if you have a complex password apparently).

  5. hobo

    To the post above brundle, VMware works in Ubuntu very very well. You should probably give that a shot.

  6. gvsm

    What if you don’t know the user name?

  7. Chima

    Awesome, hopefully it works. Thanks and GOD Bless you all.

  8. Mike

    Thank you. I used this technique after I “passwd -l”ed all my users on accident.

  9. djas

    If you don’t know the username, you can use this command to display all the users:
    cat /etc/passwd


Leave a Comment




Leave your friendly comment here.

If you have a computer help question, click here to leave it on the forums instead.

Note: Your comment may not show up immediately on the site.

Sponsored Links
Getting Started
About How-To Geek
What Is That Process?
svchost.exe
jusched.exe
dwm.exe
ctfmon.exe
wmpnetwk.exe
wmpnscfg.exe
rundll32.exe
wfcrun32.exe
Ipoint.exe
Itype.exe
Wfica32.exe
Mobsync.exe
Cmd.exe
Dpupdchk.exe Adobe_Updater.exe

Copyright © 2006-2009 HowToGeek.com. All Rights Reserved.