Reset root password in Ubuntu distribution

By default, when we install Ubuntu it doesn’t ask for root’s password. The password we provided at the time of installation enables us to access superuser privileges through sudo -i command. But, at times we need to create a separate password to access superuser privileges for security reasons. In case, we forget our root’s password it is next to impossible to make any relevant changes to our Ubuntu distribution. Therefore, it becomes imperative for us to reset root password. The method which we are about to discuss will let us reset both root’s password as well as of any other user. It is pretty straightforward and easy in execution.

But, there are few things we need to keep in mind as the steps we are about to discuss could also be done by someone else too –

  1. Don’t allow anyone to have physical access to our hard disk.
  2. We need to lock BIOS – this won’t let anyone who has bootable removable media to access our filesystem.
  3. Always set GRUB password and lock GRUB menu.

We would discuss each of these in coming articles. For the purpose of this article, we would focus only on how to reset root password of our Ubuntu distribution. Also, what we are about to do may damage our system so it is advisable to keep backup beforehand.

Reset root password in Ubuntu distribution

First, we need to reboot our system. And, just when its about to boot long press SHIFT key to get GRUB Menu.

Next, we need to press ‘e’ to edit the first entry ‘Ubuntu‘.

We need to scroll down to the line starting with linux /boot/vmlinuz… and append the line with –


Now, we need to press Ctrl+x or F10 to boot our system. It will take us to command-line prompt –


Next, we will have to remount / in read/write mode. So, at the prompt run the following –

mount -o remount,rw /

Now, we can rest password for any user through passwd command. It should be –

passwd <user-name>

To reset password for root –

passwd root

It will ask us for new password twice. Thereafter, we should get the following message if password updation is successfully done.

​passwd: password updated successfully
passwd: Authentication token manipulation error

If for some reason things didn’t go well then we may get the following error –

passwd: Authentication token manipulation error
passwd: password unchanged

Recheck whether we have typed the following command correctly –

mount -o remount,rw /

If everything is successfully completed then reboot the system.

In conclusion, we have discussed what things we need to keep in mind before we do a reset of root’s password. Thereafter, we discussed the steps needed to get the desired outcome.