Reset root password – Ubuntu Linux

1.Restart your computer and get to the GRUB menu by pressing Shift while booting.

2.Point your cursor to the Recovery mode option:

3.Press e to edit the boot options. There, look for a line that looks like this:

linux /boot/vmlinuz-3.2.0-18-generic root=UUID=b8b64ed1-ae94-43c6-92\d2-a19dfd9a727e ro recovery nomodeset:

 

4.The line will differ depending on your version and kernel but should have about the same syntax. Remove the last part of line which is:

ro recovery nomodeset and replace it with rw init=/bin/bash:

This will cause a command line to be opened on startup.
 
5.Press F10 now to reboot the machine and get to the command line. Once you are there, enter:

/usr/sbin/usermod -p '!' root

*If you get an error by copying and pasting above command, try replacing the quotation marks.

6.Now reboot the machine and the root password should be reset.
The changes you did to the boot options will also reset automatically, so you do not have to change them back.

 

Enjoy 🙂