Word – I forgot the sudo password

passwordssudo

I forgot my sudo password.
I want to install a package and it needs me my sudo password. Every time I enter the password by chance. I get the error of try again.
Would you please tell me how I can recover it or if I can change it in terminal
Thanks a lot

Best Answer

From the official Ubuntu LostPassword documentation:

Reboot your computer.
Hold Shift during boot to start GRUB menu.
Highlight your image and press E to edit.
Find the line starting with "linux" and append rw init=/bin/bash at the end of that line.
Press Ctrl + X to boot.
Type in passwd username.
Set your password.
Related Question