Wednesday, March 16, 2022

How to Reset Forgotten Ubuntu Password in 2 Minutes

 

Step 1: Boot into recovery mode

Switch the computer on. Go to the grub menu. Generally, it appears automatically – if not, then hold down the shift key or press Esc key until the boot menu appears.

If you’re using Oracle VirtualBox or VMware, you have to hold down the shift key when the logo of Oracle or VMware appears.

In the grub menu, select the “Advanced Options for Ubuntu”:

Advanced boot options in Grub menu of Ubuntu
This is grub screen

In here, you’ll see the option to go to recovery mode:

Boot into recovery mode

It will bring you to a black screen with several lines of output being displayed in a flash. Wait for a few seconds here.

Step 2: Drop to root shell prompt

Now you’ll be presented with different options for recovery mode. Here you need to choose “Root – Drop to root shell prompt“.  Just press the enter key to select this option. Like in the picture below:

Root shell prompt allows you to reset password in Ubuntu

You’ll see that when you select the root shell prompt option, an option to enter commands appears at the bottom. This is your root shell prompt and this is where you’ll use the commands to reset the password.

Step 3: Remount the root with write access

You need to have write access to the root partition. By default, it has read-only access.

Use the command below to remount it with write access:

mount -rw -o remount /

Step 4: Reset username or password

Here, you’ll be given root access. Use the following command to list all the users available:

ls /home

Based on this command, choose the “username” for which you want to reset or (say) hack the password. Now, use the following command to reset the password for the selected “username“:

passwd username

It prompts for a new password. Enter the new password twice:

Enter new UNIX password:
Retype new UNIX password:

Voilà! There you go. You have just successfully reset the password. Now exit the root shell prompt:

exit

When you exit, you’ll be back at the recovery mode menu. Select the normal boot option here.

Use recovery mode to boot normal after resetting password in Ubuntu

There will be a warning about graphics mode compatibility. Don’t worry. A complete reboot will fix any issues with this.

You should now be able to log in with the new password.


Source: https://itsfoss.com/how-to-hack-ubuntu-password/


No comments:

Post a Comment