Today John T. writes:
Matt!!! Help! Somehow, I’ve managed to lock myself out of my Ubuntu PC. I am desperate, as I have tons of files on this PC that I need to get to. Is there a method I can use for lost Ubuntu password recovery? Thanks!
John, you are in luck as Ubuntu makes password recovery a snap. And by the way, thanks for taking advantage of my premium help option (no longer available) — it’s awesome folks like you, that make this website possible! You asked this question yesterday and as promised, I am providing a solution in less than a day. Okay, back to your quandary…
The key here is being willing to write down the information on this page, so you can take it with you to the affected computer. I suggest writing it down, as you will need to follow these steps carefully, as to get things back up and running asap.
Step 1- Reboot your computer, holding down the shift button. Speaking for myself, I’ve had this work best by using the physical restart button on the front of most PC towers. While I’d like to say the restart function from the Ubuntu menu should work, it often ignores your shift key command and simply takes you back to the login screen, thus further aggravating the situation.
If all else fails, try starting up from a cold boot, waiting until the bios screen passes by, then hold down your shift key.
If you did everything correctly, you should be looking at the following screen next. As you can see, their isn’t any graphics whatsoever and you will navigate to select the correct option with your arrow keys.
You’re going to down arrow to the option marked (recovery mode). Once this is highlighted as you see in the image, click your enter key.
Step 2 – Next, you’re going to find yourself looking at a completely different screen. This screen, will have a list of options on it and will be named Recovery Options. The only option you’re going to be concerned with however, is the one marked “root”, as this is where you’re going to re-create your lost password. So once you see the screen with the list of options under Recovery Menu, use your arrow keys to head down to the root option.
Now with root highlighted, use your tab key to select OK. Now hit the enter key. Instantly, you will notice root@something appearing immediately below the Rescue Menu. You can hit the enter key a few times, to make sure it’s ready for your input.
Step 3 – Now that we have ourselves setup with root access, at the command line, we’re ready to get down to business. The first thing we need to do is make the hard drive writable. This is where most people get confused. See, as the root prompt stands now, you can view anything you like. However it’s not setup with write access just yet. So let’s fix that right now, shall we?
From the command line that you’ve gotten yourself to, you will want to type in the following to make your hard drive temporarily writable while under Recovery Mode.
mount -o remount,rw /
Note, that is an o (as in “oh”) and not a 0 (zero) after mount. You need to make sure the spacing and placement of the comma, are exact as well. And yes, there is a space between “rw” and “/” in the command I’ve listed.
Now that the hard drive containing Ubuntu has been made writable, the next step is to actually go through the process of generating a new password. At the prompt, type the following:
The username you type will be the one you were trying to login to. So for me, it would be matt while your username, obviously will be different. Once you’ve followed the prompts, choosing your new Ubuntu user password, then confirming it at the second prompt, you’re all set.
Your last step is to simply type in restart, then hit enter. This will restart your computer and bring you back to the normal login page for Ubuntu. Select your login user as normal, enter your NEW password and you’re all done! You’re now able to login, using your NEW password like nothing had ever happened!