By default, sudo keeps the password in “memory” for 5 minutes (at least under Ubuntu).
If you want to change that value
$ sudo visudo
Add the following line before the other “Defaults” line :
Or simply append “timestamp_timeout=2” to the existing Defaults line like :
This will set the timeout to 2 minutes…
Set to 0 to always require the password Set to “-1”.. you will only have to prove you know the password once.
Options on the Defaults line are system-wide settings.
If you want to apply settings to particular users add :
If you don’t want to be prompted for the password at all, you must have a rule like
johndoe ALL=(ALL) NOPASSWD: /bin/mount
This would never require the password for the command “mount”.
If you don’t want to ever be asked for the pass when using sudo :
johndoe ALL=(ALL) NOPASSWD: ALL