If you forget your Ubuntu password, there are a few easy steps you can take to reset it. First, boot your computer from the live CD. If you’re using Ubuntu 10.04 LTS (Lucid Lynx), use the following instructions:
- Insert the Ubuntu 10.04 LTS live CD into your computer’s optical drive.
- Boot your computer from the live CD.
- When the Ubuntu desktop appears, click on the “Ubuntu One-Click Install” icon on the bottom left corner of the screen.
- In the “Install Ubuntu” window that appears, click on “Select a language and region.”
- Click on “English (United States).”
- Click on “Continue.”
- In the “Select a mirror” window that appears, click on “Ubuntu US East (Virginia).”
- Click on “Continue.”
- In the “Installation Type” window that appears, select “Standard Installation.”
- Click on “Install Now.” If you’re using Ubuntu 10.10 (Maverick Meerkat), use these instructions: 1) Open a terminal by pressing Ctrl+Alt+T in Windows or by clicking Start -> All Programs -> Accessories -> Terminal 2) Enter this command to get a list of available disks: sudo dmesg | grep -i disk 3) If you see an entry for /dev/sda3 in this list, your computer is configured to boot from that disk first and not from CDs or DVDs 4) Change to that disk by entering this command: sudo mount -t vfat /dev/sda3 /mnt 5) Enter this command to install Ubuntu onto that disk: sudo apt-get install ubuntu 6) Change back to your original disk by entering this command: sudo unmount /mnt 7) Reset your password by entering this command: ..
Note that we’ll also cover how to protect yourself against somebody else resetting your password, so stay tuned!
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.
Once the system boots, open up a new Terminal window from Applications \ Accessories and then type in the following command:
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.
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.
The next command will mount the hard drive in the /media/sda1 folder.
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.
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.
Note that you’ll have to type your username after the passwd command in order to change the right password.
Now you should be able to reboot your system and log yourself in with your new password.