Recently I came across some documentation that stated that once sudo
was successfully ran it stays unlocked for 5 minutes and can be reset through sudo -k
. What I was wondering was how do I increase this 5 minute timer to say 10 minutes?

- 197,895
- 55
- 485
- 740

- 2,498
1 Answers
From man sudoers
:
sudoers
uses time stamp files for credential caching. Once a user has been authenticated, the time stamp is updated and the user may then usesudo
without a password for a short period of time (15 minutes unless overridden by thetimeout
option). By default,sudoers
uses atty
-based time stamp which means that there is a separate time stamp for each of a user's login sessions. Thetty_tickets
option can be disabled to force the use of a single time stamp for all of a user's sessions.
The "timeout" above refers to timestamp_timeout
,
also explained in man sudoers
:
timestamp_timeout
Number of minutes that can elapse before
sudo
will ask for a passwd again. The timeout may include a fractional component if minute granularity is insufficient, for example 2.5. The default is 15. Set this to 0 to always prompt for a password. If set to a value less than 0 the user's time stamp will never expire. This can be used to allow users to create or delete their own time stamps viasudo -v
andsudo -k
respectively.
To modify the default setting of timestamp_timeout
,
edit the sudoers
configuration using the sudo visudo
command,
and add a line near the top of the file like this:
# timeout after 30 minutes (instead of the default 15)
Defaults timestamp_timeout=30

- 36,264
- 56
- 94
- 147

- 4,888
timeout
? – NerdOfCode Dec 17 '17 at 20:14