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.
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.
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.
Then choose “Drop to root shell prompt” from this menu.
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.
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.
You’ll first be presented with a screen that looks very similar to this one:
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
Once you hit enter after adjusting the kernel line, you’ll need to use the B key to choose to boot with that option.
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
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.
well that just makes it too easy to hack someones computer… :/ whats the point of the password other than to slow them down now…
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!
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?
@All
I’m going to cover how to prevent this in the next day or so =)
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.
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.
@thesquirrelwood
That’s a good point, I should have included that… updated.
@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).
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…
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?
@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 =)
Nice post, good screenshots
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.
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…)
It is not much harder in Windows. Boot from the EBCD boot disk, and change the password.
Its an amazing post..quite useful…….:)
how do i disable that menu for resetting my ubuntu password?
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.
Not harder in windows – just use OPHCrack – i usually get passwords in a few minutes or less.
http://ophcrack.sourceforge.net/
Great post. It helped me out
thnkx a lot i goota fuound it working quickly
thnkx a lot…………………………………
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.
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!
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?
i did that but when it reboots it says that the admin cant login from the login screen!?!?!
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.
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?
LOL
@remco_t
there’s no such thing as 100% not making a typo… everyone does it.
passwd not password
i did this it said unix password reset i put in new password passwd geek it stiill says wrong user passwd helpppp
Thanks! Works great!
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?
How many cookies does a website need?!? Sjees louis.
Surely the case.
Thank you. Complete and Clear Instructions to what I wanted to do.
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…
Thanks. I’m a newby running gNewSense. Your hint worked great.
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
ubuntu and vista are easier to hack then they are to login
ummm it wants my current password in order to change it?????
Nice saved my ass great post
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.
this doesn`t work!!!
what about the administrator not allow the permition
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
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.
U R Awesome! Thank U!!!
Thank you for help. Your site is great!!!!
Brazil – Curitiba.
Hi, I can’t type any leters or numbers when trying to change the pass. Tnx
All fine now
Excelente mode
Thank you
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?
Please make a new article to counter this glitch, thank you
username ?
passwod?
eduubuntu
it so good
i thank you for your help
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..
oooh… It is amazing…
thank you very very much…
@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.
hi, when loading i dont have any grub menu!
What should i do?
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.
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.
I upgraded from ubuntu 1010 forgot my username, I power up, hit escape and it wants my username password, please help!!!!
thank you………………nice article