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.















Reader Comments (Page 1 of 1)
5-12-2008 @ 5:35PM
noelleprocaccio said...
good
Reply
5-12-2008 @ 6:31PM
Stephen said...
so my ubuntu machine can be broken into THAT easily?
wtf?
Reply
5-13-2008 @ 8:42AM
Matias Korhonen said...
Pretty much any computer you can get physical access to can be easily broken into.
5-12-2008 @ 8:23PM
hybrid-kernel said...
--This is a feature not a bug--
just lock grub, problem solved.
Reply
5-12-2008 @ 8:24PM
Kristin Shoemaker said...
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.
5-13-2008 @ 7:48AM
jghjmghjghj said...
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.
5-13-2008 @ 12:51PM
Christina Warren said...
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.
5-13-2008 @ 7:48AM
African Boy said...
Will it work on other Linux distros?
Reply
5-13-2008 @ 7:48AM
Iampriteshdesai said...
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.
Reply
5-13-2008 @ 12:08PM
James said...
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.
5-20-2008 @ 9:03AM
Mike said...
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.
Reply
6-27-2008 @ 9:30AM
nexha said...
qe ta theva mo..
Reply
6-29-2008 @ 7:53PM
Jonas said...
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?
Reply