This is an easy method for changing the root password on Ubuntu, and it should work on other Linux too.
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.
In the grub menu, select the “Advanced Options for Ubuntu”:
Go to 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:
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:
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“:
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:
After exiting you’ll be back at the recovery mode menu.
Select the normal boot option here.
Don’t worry a the warning graphics mode compatibility. A complete reboot will fix any issues with this.
You should now be able to log in with the new password.
While entering the new password you might be prompted with Authentication token manipulation error like this:
passwd username Enter new UNIX password: Retype new UNIX password: passwd: Authentication token manipulation error passwd: password unchanged
The reason for this error is that the file system is mounted with read access only. Change the access and remount the file system in the following manner:
mount -rw -o remount /
Now try to reset the password again. It should work now.
If you still having trouble booting from the USB please contact us via this page, or by email: firstname.lastname@example.org