formats

Change sudo default password cache

Published on August 4, 2012, by + in linux, sysadmin.



sudo’s default password cache time is 5 minutes. To change the default time, it is possible to edit a setting in /etc/sudoers as desired. I’ll show you how!





Edit /etc/sudoers with your desired text editor, or as standard with sudo visudo:

$ sudo visudo





For example, to increase the timeout to 30 minutes for user jsmith, you would put in a line as follows at the bottom of the file:

Defaults:jsmith timestamp_timeout=30


sudo_timeout


Save that file, and you are all set.




Additional Notes:

A value of 0 makes sudo always ask for a password. In other words, 0 disables the cache.

Defaults:jsmith timestamp_timeout=0




If set to a value below 0 (ex, -1) the cache will never expire. You should of course never do this, but alas, the option is available.

Defaults:jsmith timestamp_timeout=-1



Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Notify me of followup comments via e-mail. You can also subscribe without commenting.

Home linux Change sudo default password cache