1 Reset forgotten password with sudo user
If you can login sudo user, you can use sudo for resetting forgotten password.
$ sudo passwd <username>
2 Reset forgotten password with root user on recovery mode
If you cannot login sudo user because sudo user’s password is forgotten, you can use root user on recovery mode.
Press SHIFT key for showing GRUB menu.
Select “Advanced options for Ubuntu”.
Select kernel which has “recovery mode” suffix.
After remounting root file system with rw, you can reset forgotten password.
Press Enter for maintenance (or press Control-D to continue): # mount -o remount,rw / # passwd <username> Enter new UNIX password: Retype new UNIX password: passwd: password updated successfully # reboot