You know the feeling when you want access to your Ubuntu box and you can't remember the password. You try different combinations of ones that you remember, using uppercase, lowercase, number and special character combinations...and then you hit that wall where enough is enough. Here's an easy solution to resetting your Ubuntu password.
THE EASY WAY - Having the option of recovery mode
1. Reboot your computer (or virtual machine).
2. A screen should pop up upon reboot that gives you various Ubuntu option including recovery mode.
3. Using the down arrow key, scroll down to and select the most recent recovery mode option (the first one) by pressing 'Enter'.
4. On the next screen, select:
Root Drop to root shell prompt
5. See 'THE COMMAND PROMPT' section below...
THE HARD WAY - NOT having the option of recovery mode
1. Select the regular boot kernel (generally the default one), then use 'e' to edit the commands before booting.
2. Using the down arrow key, scroll down to: (the number signs will vary depending on which flavor of Ubuntu you are using)
3. You have two ways you can choose here during boot, Splash Screen or No Splash Screen. If you want no splash screen, follow along below. If you do want the splash screen, press 'c' to enter the command line.
NO SPLASH SCREEN
(a) Press 'e' to edit the selected command in the boot sequence.
(b) This next screen should look something like this:
[ Minimal BASH-like line editing is supported. For
the first word, TAB lists possible command completions.
Anywhere else TAB lists the possible completions of a
device/filenname. ESC at any time exits. ]
(c) At the prompt, type:
(d) After adjusting the kernel line and pressing 'Enter', you will be taken back to Step 2 of 'THE HARD WAY' section.
THE COMMAND PROMPT WINDOW
1. In the command prompt, use the following command, replacing <username> with the user name of the lost password account:
2. A prompt will come up saying:
Enter new UNIX password:
3. A second prompt will ask you to reenter the password you just entered:
Retype new UNIX password:
4. If all went well, you will receive a message saying:
passwd: password updated successfully
5. At the next two command prompts type 'sync' then 'reboot'. ('Sync' synchronizes the data on the disk with memory.)
6. Revel in your success!