In Ubuntu (and any other Ubuntu-based distro), when you use a “sudo” command, the system will prompt you for your password. After the first “sudo” command, the system will remember your password for the next 15 minutes so you don’t have to enter any more password for subsequent “sudo” command. If, however, you feel that the 15 minutes is a bit too long/short, here is how you can change it.
Full article here:
Change the sudo Password Timeout in Ubuntu (Make Tech Easier)