Stupid Ubuntu tricks: 5 Steps for resetting a forgotten password
It happens to everyone. You have so many usernames and passwords that you can't remember them all. Fortunately, Facebook, Gmail, and about a billion other online services have a "forgot password" link. Just click it and the web service will either email your password to you or allow you to reset it and enter a new one.
But what happens when you forget the password for your operating system. Not that this has ever happened to us, but hypothetically let's say we were trying to perform a fresh install of Ubuntu on a laptop this afternoon. We zipped through the installation screens so quickly that we may have accidentally inclued a typo in our password. So when the installation was complete, our (still hypothetical) computer booted up, loaded a splash screen, and then wouldn't let us login no matter how many variations of our password we type.
While you might think the easiest thing to do is reinstall Ubuntu, (after all, this is a clean install so it's not like we'd be losing any data on our hypothetical system), you can save yourself 15-30 minutes by changing the password. It turns out you don't have login to change your password. As we discovered thanks to a useful post on the Ubuntu forums, you can do it from the bootloader screen. Check out the 5 easy steps after the jump.
- Turn on your computer, and as soon as you the Press Esc to enter grub message, press the escape key.
- Select the option that says (recovery mode).
- Your PC will boot into a shell. Once you get a command prompt, type "passwd username" where the username is your username. If you can't remember this, then you can type "ls /home" which should bring it up.
- Enter a new password when prompted, and again when prompted again
- Type "shutdown -r now" to reboot your syste,
That's it. You should now be able to login with your shiny new password.













Comments
15
Subscribe to commentsnoelleprocaccioMay 12th 2008 5:35PM
good
StephenMay 12th 2008 6:31PM
so my ubuntu machine can be broken into THAT easily?
wtf?
Matias KorhonenMay 13th 2008 8:42AM
Pretty much any computer you can get physical access to can be easily broken into.
hybrid-kernelMay 12th 2008 8:23PM
--This is a feature not a bug--
just lock grub, problem solved.
Kristin ShoemakerMay 12th 2008 8:24PM
Good point...
Funny, I saw this story and thought of the way I've always retrieved passwords that slipped my mind... Entirely differently, of course.
Remember, as well, any machine with an accessible BIOS is fair game for anyone with a LiveCD and the desire to reset the host machine's password (or worse). Generally, if you're in an environment where you think that someone could/would/might do anything of that nature, it's a good idea to lock it ALL down.
--In other news--
I've had less consistent luck when dealing with passwords on Windows NT-based machines. (Gotta love that the previous people on the IT circuit didn't write down the administrator passwords to a whole classroom full of computers!)
There seems to really be no simple way to get those... although I've found on more than one occasion I either miraculously typed in the right password on the third try, or Windows felt my pain and decided to let me in as Administrator anyway.
jghjmghjghjMay 13th 2008 7:48AM
I don't know about older versions of NT, but in XP it's really trivial. There are special bootable CDs that do exactly that. I can't think of the name right now, but it should be easy to find. I used it successfully in the past.
Christina WarrenMay 13th 2008 12:51PM
Yeah, NT/2000/XP all use the same password recovery tool (http://home.eunet.no/pnordahl/ntpasswd/) that you can load onto a floppy (if the machine is really old) or CD. Any encrypted files in Vista or XP will still be unreadable unless you remember the actual password, but you can at least get back into the system.
IampriteshdesaiMay 13th 2008 7:48AM
Even windows password can be changed that way. Just go to safe mode. By pressing F8 while it loads and then select administrators account and then to control panel and there are some services which i forgotright now. But it can be done. I have done it in 5 min.
JamesMay 13th 2008 12:08PM
Um, I'm pretty sure that if you actually bother to password protect your Administrator account, it doesn't just magically ignore the password when you boot in safe mode.
Could be wrong, though.
African BoyMay 13th 2008 7:48AM
Will it work on other Linux distros?
MikeMay 20th 2008 9:03AM
I'm pretty sure being able to reach a maintenance console without a password is the sign of a poorly set up Linux installation. My systems always require the root password before bringing me to the maintenance console.
nexhaJun 27th 2008 9:30AM
qe ta theva mo..
JonasJun 29th 2008 7:53PM
So what happens in the case of loosing root access to your recovery shell?
We did the above mentioned on one installation and found that after the reboot we could not access the shell in maintenance mode as it was asking for a password. We tried the password that we had set previously for the root user, though it is still denying access.
Any ideas?
annetteAug 6th 2008 9:14PM
will this work on a MacBook?
annetteAug 7th 2008 7:52AM
will this work on macbook?