Tutorial 12 - Reset Forgotten password in Ubuntu Linux
What you will Learn:
Why reset password ?
Reset root password
Reset superuser password
Verify whether superuser password is successfully reset
SSH using new superuser password
Why reset password ?
If you have forgotten superuser password, you can reset it. The password reset process is divided into 2 sections:
1) Reset root password
2) Reset superuser password
Reset root password
Step 1: On Ubuntu VM, click X icon
Step 2: Select ‘Power off the machine’
Step 3: Click OK button that you see above
Step 4: Start the VM machine
Step 5: Keep pressing escape ‘Esc’ key till you get below screen
Step 6: Press 'e' key to get the below screen
Step 7: Scroll down using down arrow key until you see the line that begins with 'linux /boot/vmlinuz', see below
Step 8: In the above highlighted section, you can see the text
"ro quiet splash $vt_handoff"
Step 9: Press the right arrow key to bring the cursor to the starting of "ro quiet splash $vt_handoff"
Step 10: Delete the text "ro quiet splash $vt_handoff"
Step 11: Replace the above text with “rw init=/bin/bash”
Step 12: Reboot by pressing F10 or Ctrl + x
Step 13: Execute ‘passwd’ command to reset root password
MEMORISE THIS ROOT PASSWORD FOR LATER USE
Step 14: Reboot by executing ‘exec /sbin/init’
SO WE HAVE SUCCESSFULLY RESET THE ROOT PASSWORD.
Reset superuser password
We will next reset superuser password (also user password).
Step 15: Once reboot is complete, click X on Ubuntu machine
Step 16: Select ‘Send the shutdown signal’
Step 17: Click OK
Step 18: Start Ubuntu machine
Step 19: Keep pressing escape key till you get below screen
Step 20: Using the arrow key, select ‘Advanced options for Ubuntu’, see below
Step 21: Hit Enter
Step 22: Select recovery mode option as seen below
Step 23: Hit Enter
Step 24: After sometime below screen would come up. Select ‘root’ as seen below
Step 25: Hit Enter
Step 26: Below screen comes up asking us to ‘Give root password for maintenance”
STEP 27: Enter root password that we had reset above and Hit Enter
STEP 28: You should be able to see the root prompt, see below
STEP 29: Execute mount -o remount,rw / command and hit Enter
STEP 30: Execute ‘passwd <username>’ to change superuser password. This will also be the user password
NOTE 1: MEMORISE THE SUPERUSER PASSWORD. YOU WOULD BE NEEDING THIS PASSWORD WHEN YOU EXECUTE Sudo COMMANDS.
NOTE 2: SUPERUSER PASSWORD IS ALSO YOUR NORMAL USER PASSWORD
STEP 31: Execute ‘reboot' command and Hit Enter
SO WE HAVE SUCCESSFULLY RESET THE SUPERUSER PASSWORD.
Verify whether superuser password is successfully reset
STEP 32: After system reboots, open terminal and execute
‘sudo -i’ command, type the new superuser password and hit Enter. You should be able to successfully login and enter the root prompt. This verifies that we were able to successfully reset superuser password
STEP 33: Note down the IP address
STEP 34: Exit to come out from superuser session
SSH using new superuser password
Let us see if we can SSH to the new ip address using the new superuser password.
Let us open Git bash terminal.
See below, we are able to SSH using the new ip address and new user password. We are also able to login as superuser by executing ‘sudo -i’ command
Let us execute the same commands from OpenSSH client. We are successful here as well
Finally, click X on Ubuntu machine
You can choose ‘Save the machine state’ and click Ok
Thank you for reading!