1) Hold Shift during boot to start GRUB menu.
2) You have to get into recovery mode.
3) Enter root to prompt shell.
root@ubuntu:~#
4) At this stage you should have a read-only filesystem. You have to remount it with write permissions:
root@ubuntu:~# mount -o remount ,rw /
5) Now we can set the user’s password with the passwd command. (In this example I use root as the example, you should substitute whatever the user’s username is):
root@ubuntu:~# passwd root
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
root@ubuntu:~#
6) Done~
