SEARCH

How-To Geek

Reset Your Forgotten Ubuntu Password in 2 Minutes or Less

If you’ve ever forgotten your password, you aren’t alone… it’s probably one of the most common tech support problems I’ve encountered over the years. Luckily if you are using Ubuntu they made it incredibly easy to reset your password.

image 

All it takes is adjusting the boot parameters slightly and typing a command or two, but we’ll walk you through it.

Reset Your Ubuntu Password

Reboot your computer, and then as soon as you see the GRUB Loading screen, make sure to hit the ESC key so that you can get to the menu.

image

Root Shell – Easy Method

If you have the option, you can choose the “recovery mode” item on the menu, usually found right below your default kernel option.

image[3]

Then choose “Drop to root shell prompt” from this menu.

image[6]

This should give you a root shell prompt.

Alternate Root Shell Method 

If you don’t have the recovery mode option, this is the alternate way to manually edit the grub options to allow for a root shell.

First you’ll want to make sure to choose the regular boot kernel that you use (typically just the default one), and then use the “e” key to choose to edit that boot option.

image 

Now just hit the down arrow key over to the “kernel” option, and then use the “e” key to switch to edit mode for the kernel option.

image

You’ll first be presented with a screen that looks very similar to this one:

image

You’ll want to remove the “ro quiet splash” part with the backspace key, and then add this onto the end:

rw init=/bin/bash

image 

Once you hit enter after adjusting the kernel line, you’ll need to use the B key to choose to boot with that option.

image 

At this point the system should boot up very quickly to a command prompt.

Changing the Actual Password

You can use the following command to reset your password:

passwd <username>

For example my username being geek I used this command:

passwd geek

image

After changing your password, use the following commands to reboot your system. (The sync command makes sure to write out data to the disk before rebooting)

sync
reboot –f

I found that the –f parameter was necessary to get the reboot command to work for some reason. You could always hardware reset instead, but make sure to use the sync command first.

And now you should be able to login without any issues.

Lowell Heddings, better known online as the How-To Geek, spends all his free time bringing you fresh geekery on a daily basis. You can follow him on if you'd like.

  • Published 09/22/08

Comments (74)

  1. Dcw329

    well that just makes it too easy to hack someones computer… :/ whats the point of the password other than to slow them down now…

  2. mfuasi

    Thanks a handful.For the newbies it will be of great help as this is a common problem.I have a question though,is it compulsory to enter numerics as your password so as for it to function?I used characters at first as i was setting up Ubuntu but the password didnt go through.I had to reinstall Ubuntu to re enter a new password and i used numerics to my success!

  3. J/C.B II

    I must say, Dcw329 is correct, this would make it extremely easy for hackers, or bothersome roommates to get into your computer.

    Is there any way to disable this function so a password reset could not occur?

  4. The Geek

    @All

    I’m going to cover how to prevent this in the next day or so =)

  5. thesquirrelwood

    editing the kernel line is stupid. Just press down again at the grub menu and enter “recovery mode”. This is exactly one of the reasons recovery mode is there.

    And to everyone complaining it makes it too easy to hack someones computer: Encrypt your drive if you actually care. Otherwise, anyone with physical access can do whatever they want anyway.

  6. Scott Wegner

    Good article– but like the others above, I would really like to see a follow-up on how to lock-down your GRUB, if not more.

  7. The Geek

    @thesquirrelwood

    That’s a good point, I should have included that… updated.

  8. wags062

    @DCw329, @J/C.B II

    You can first edit /boot/grub/menu.lst to remove the recover entries built in to the boot menu that thesquirrelwood mentioned.

    Then, you can put a password on your grub menu so that you need to enter a password before you can edit a boot entry. I forget what the directions are exactly…somebody may want to verify these, but I _think_, off the top of my head, it’s…

    1. Open a shell and type the command “grub” to enter the interactive grub shell.
    2. Type md5crypt and hit enter.
    3. Enter the password you want on the menu and hit enter to get the encrypted form.
    4. Edit /boot/grub/menu.lst and add the line: password –md5 encryptedpasswordfromstep3goeshere

    I’m 99% sure those are the accurate steps…haven’t had to set up a Linux install from scratch in quite some time (and I’m on my Windows box now, so I can’t verify).

  9. Dcw329

    lol… i dont even have linux… so im not too worried… lol… but i thought it was kind-of funny that it is so easy to hack a computer… but if there is a way to stop that (as the geek metioned) then it should be no big deal for you guys…

  10. Dcw329

    now that i think of it… i should probly ask… is there a way to do that with windows? should i be worried about my windows vista laptop?

  11. The Geek

    @Dcw329

    If somebody has physical access to your computer, they can do almost anything they want, unless your hard drive and data are encrypted.

    It’s not quite as easy to reset the Vista password, but it is definitely possible.

    [Edit] This article will be the first in a series on this topic… I’ll try and cover all the important points for Windows and Linux =)

  12. Srikanth

    Nice post, good screenshots :)

  13. J/C.B II

    I can not believe the amount of comments from this article. The hilarious thing is that if someone did get into my computer, they would find nothing expect a wallpaper.png and perhaps a few comic book files.

    If someone seriously wants to gain access to your computer, they’ll find a way too.

  14. Dcw329

    i’m not worried about the CIA trying to break into my computer… but if my friend wants play a prank or something, i don’t want him to be able to get it… if it is common knowledge how to break into a computer, i want to stop it… if its difficult, and uncommon… i don’t think i need to worry… (i don’t have many computer savvy friends… so i’m not panicking…)

  15. Grant

    It is not much harder in Windows. Boot from the EBCD boot disk, and change the password.

  16. harsh

    Its an amazing post..quite useful…….:)

  17. Pinky

    how do i disable that menu for resetting my ubuntu password?

  18. Varney

    I agree with thesquirrelwood. While it’s good to take security precautions, if anyone has physical access to your computer, no password is going to save you. If you want to prevent someone from getting your data go with encryption.

  19. Shane

    Not harder in windows – just use OPHCrack – i usually get passwords in a few minutes or less.
    http://ophcrack.sourceforge.net/

  20. Mariella

    Great post. It helped me out

  21. ashok kumar

    thnkx a lot i goota fuound it working quickly
    thnkx a lot…………………………………

  22. me

    In the last command where you reboot the computer what are those characters after reboot? On my screen it looks like lower case a with caret over it, euro sign and then left double quote in front lower case f.

  23. remco_t

    Tried to follow this to reset my passwd (Jaunty upgrade messed up my passwd strangely, know 100% I’m not making a typo…) and this is what I got in my terminal:

    root@(none):/# password remco
    send-mail: fatal: could not find any active network interfaces
    Can’t send mail: sendmail process failed with error code 75
    root@(none):/# _

    Any help would be appreciated!

  24. Kangarooo

    Remco type:
    passwd remco

    and i hav question:
    if i have one user so password for sudo is the same so if some one changes user password then sudo password also changes? or on installation for both users i got same password?

  25. jujugoboom

    i did that but when it reboots it says that the admin cant login from the login screen!?!?!

  26. Henkkagg

    Thanks, very good screenshots and explanations. But i can’t understand why Ubuntu makers made this so easy. I mean that of course advanced users can protect their HardDrives from hacking with this method, but basic users, like me before reading this, may be pretty confused after someone hacks their passwords.

  27. Joe Whitehead

    Uhm because you can just use a boot CD to do the same thing?

    Besides, if you physically lock the computer inside a cabinet and turn off recovery and password Grub like above, you’re all set. If you have the computer sitting in front of you and can open it, then no BIOS password in the world will save you. If you can’t open it, but you can boot off a CD or log into an administrator account… Same thing. If someone discovers a backdoor in some service you’re running that allows admin access, well ditto. Encryption works even if someone gets smart and uses a boot CD or one of those external hard drive adapters on a second PC. Why else would there be RIPA laws in the UK?

  28. gcampton

    LOL
    @remco_t

    there’s no such thing as 100% not making a typo… everyone does it.

    passwd not password

  29. fred

    i did this it said unix password reset i put in new password passwd geek it stiill says wrong user passwd helpppp

  30. Loco_head

    Thanks! Works great!

  31. karl

    ubuntu – forgot my password, when i hit ‘esc’ after powering on, all i get is “MBR 2FA:” and blinking cursur, not the “GRUB LOADING STAGE1.5″ that you and others have referenced. can i still reset for a new password?

  32. Guest

    How many cookies does a website need?!? Sjees louis.

  33. Trey Mixon

    Surely the case.

  34. Manouchehr

    Thank you. Complete and Clear Instructions to what I wanted to do.

  35. Satis

    I have been using Ubuntu for last two and a half yrs and was not even aware that the pwd of an account can be changed so easily.This is really absurd…i thought my documents are safe in Ubuntu,but after reading this post,i think iam most vulnerable if anyone gets the physical access to my system..
    Seriously,Ubuntu community should really consider some blocking/unblocking mechanism for this feature so that the same can be enabled/disabled anytime by doing some changes in boot files.(sort of hardening the Ubuntu)
    Maybe the option ‘Drop to root shell prompt’ should not made visible/invisible depending on the setting made by user…

  36. plgx

    Thanks. I’m a newby running gNewSense. Your hint worked great.

  37. achilleas

    i m trying what you said but when i get the enter new unix password when i press the first digit it takes me to retype new unix password so i cant enter any password…

    can anyone help?

    thank you

  38. dh

    ubuntu and vista are easier to hack then they are to login

  39. hi idiots

    ummm it wants my current password in order to change it?????

  40. Ryan

    Nice saved my ass great post

  41. rcmichelle

    Last time I forgot my password and tried everything i could do but failed, until I found this great tool Windows Password Software. It works great, and you can google it.you can try to google it.

  42. Gebrehiwet

    this doesn`t work!!!
    what about the administrator not allow the permition

  43. Tom

    I have installed Ubuntu on VMWARE Player and it is asking for my password – but I have not logged in before! How can I log in, or what username / passord combination should I use?

    Tom

  44. Tony Marcel

    Dear sir…
    I am really gratefull….Your help was extremely usefull…I wish you all a Merry Xmass and Happy 2011…………..Tony……..Cairo Egypt
    Keep up the excellent work.

  45. Miel

    U R Awesome! Thank U!!!

  46. Sergio

    Thank you for help. Your site is great!!!!
    Brazil – Curitiba.

  47. mad

    Hi, I can’t type any leters or numbers when trying to change the pass. Tnx

  48. mad

    All fine now :x

  49. Arturo

    Excelente mode

    Thank you

  50. Sam B

    I’m having a similar problem with Ubuntu 7.10 ( can’t reset the password for account “user”), which doesn’t have Prompts in the Recovery Mode as in 8.04. What steps should I take?

  51. Will

    Please make a new article to counter this glitch, thank you

  52. s

    username ?
    passwod?
    eduubuntu

  53. fitsum

    it so good
    i thank you for your help

  54. vince

    HELP!!!

    I HAVE A CRUNCHBANG LINUX AND I FORGOT THE USERNAME AND PASSWORD.. IVE TRIED TO FOLLOW THE STEPS ABOVE AND IT’S NOT WORKING.. AFTER I SELECT RECOVERY MODE AND HIT “E” IT WILL GO TO THE NEXT WINDOW AND THEN I WILL SELECT THE LINE THAT STARTS WITH LINUX AND THEN I DONT KNOW WHAT TO DO NEXT.. PLEASE HELP IVE BEEN TRYING TO FIX THIS SINCE LAST MONTH..

  55. JaGaa

    oooh… It is amazing…
    thank you very very much…

  56. Kamran

    @Satis

    If someone “evil” can physically access your machine, he can even torch it; no matter what OS you are using. With Ubuntu you can easily reset your password if you forget it, all you need is “physical access” to your machine.

    If you are worried about security then you should consider putting a password on grub; or disable the single user mode altogether, so that you cannot reset your linux password if you forget it.

  57. John

    hi, when loading i dont have any grub menu!
    What should i do?

  58. Magnus

    I believe the Ubuntu 11.04 fixed this “problem”. When I run recovery mode, and “drop root shell prompt.” it asks for a root password to continue. No passing through there.

  59. Alex

    Magnus, it’s actually done this since 10.04, it’s doing it for me now. Luckily there is an account I have root access too (silly me) so I can reset it from there.

  60. kevin

    I upgraded from ubuntu 1010 forgot my username, I power up, hit escape and it wants my username password, please help!!!!

  61. shakir

    thank you………………nice article

  62. Elizabeth

    Ok, I got my password changed, but how do I change the Username?

    My options on the “root shell” have 2.6.24-16-generic. Does this matter? Do I just need to upgrade to a newer version once I figure out how to change the username? Thanks!

  63. jsonx

    The “Alternate Root Shell Method” worked for me perfect. Thanks

  64. didi

    Hi I try the steps in the root@(none);/# here I can right command;
    Help me pleas

  65. hendri

    hmmmm nice articel. thanks for you sir

  66. James

    Hi I have ubuntu 9.04 and was trying the above but to no avail. Would there be anything I need to do different thanks!!!

  67. Lena

    Hey, thanks for the instructions but somehow I get a totally different menu then the rest of you…So I type in passwd username and then it gives me like 10 different options and whatever i type in next it either says invalid commant or not found or something similiar.
    Does anyone have a clue what I’m talking about and could give me and exact command please?
    The option look like this: -letter, –action (example: -d, –delete/ -u, –unlock)
    Thanks a lot!

  68. John

    I had to reset my password and had trouble getting the GRUB menu. I’m using Kubuntu version 8 or 9, not sure. If Esc doesn’t work you need to hit the Shift key to bring up the GRUB menu. Once there the method in this article worked fine

  69. jason

    It’s workng cool…..but wat is d proces is going on when we replace “ro quiet slash” with the “rw init=/bin/bash”
    plz explain the inner proces how it woks plz plz plz……..

  70. Faisal Masood

    Just reset my first Ubuntu forgotten password. It was quick and easy.

  71. kamarul

    simple but useful tutorial.
    I am not a regular ubuntu user, the step is quite similar if you forget root password on redhat.

    on redhat you do the editing in grub, put linux single or single then boot.

    TQ

  72. yeah

    Removing a Window’s password is just as easy.

  73. Basawaraj

    Excellent post….Thank You!!

  74. Henkdevries

    Thanks a LOT

Get Free Articles in Your Inbox!

Join 134,000 newsletter readers

Email:

Go check your email!