Boot up the machine, and after the BIOS screen, hold the Right Shift when booting up, to get the Grub menu
Select the GRUB (Recovery Mode)
Hit the down arrow until you select the 2nd entry from the top (the one with the recovery mode in the description) and then hit Enter.
Using the arrow keys scroll down to root and then hit Enter.
You should now see a root prompt, something like this:
At this stage you should have a read-only filesystem. You have to remount it with write permissions:
mount -rw -o remount /
Now we can set the user’s password with the
passwd command. (In this example I will use jorge as the example, you need to substitute whatever the user’s username is):
root@ubuntu:~# passwd <user> Enter new UNIX password: Retype new UNIX password: passwd: password updated successfully root@ubuntu:~#
Type in what you want the new password to be at the prompt. After it’s successful reboot the machine and the user will be able to log in with their new password.