How to extend sudo Password Timeout


sudo password input

System administrators also authenticate as normal users and use sudo when administrative tasks are performed. On the first call, sudo asks for the password of the user who is authorized to sudo.

The default password timeout is 15 minutes. Therefore, if sudo is run again within 15 minutes (900 seconds), the prompt to re-enter the password will not occur.

Extend Timestamp Timeout

The timestamp_timeout defines the number of minutes that elapse before sudo should ask for the password again. Edit the /etc/sudoers file to change the timestamp_timeout.

I recommend using command visudo to edit the /etc/sudoers file. Add the value timestamp_timeout on the line after “Defaults”, in the /etc/sudoers file.

sudo su

A grep shows the searched lines, here a sudoers at Linux Mint.

grep Defaults /etc/sudoers
sudoers timestamp_timeout

The default setting is Defaults env_reset

sudo visudo 

Edit sudoers so that the Defaults line looks like this:

Defaults    env_reset,timestamp_timeout=-0

timestamp_timeout=-1 (minus one) causes the sudo password to never expire.

  For Debian/Ubuntu distributions, the -0 option did not work. A higher value e.g. 60 is accepted.

timestamp_timeout=0 (zero) causes the sudo password to expire every 0 (zero) seconds. This means that each time sudo is called, the password is asked.


How useful was this post?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate this post.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?

Leave a Reply

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