Change Sudo Password Timeout

I always log in as a normal user and use sudo when needing to do administrative tasks. When you first use command with sudo, you have to insert your user’s password, at the first sudo usage.

The default pasword timeout is 15 minutes. So if you use sudo twice in 15 minutes (900 seconds), you will not be asked to type the user’s password again.

The timestamp_timeout:

The timestamp_timeout defines the number of minutes that can elapse before sudo will ask for a password again. To modify the timestamp_timeout, edit the /etc/sudoers file.

I recommand you to use visudo, when editing the /etc/sudoers file.

Append the timestamp_timeout value to the “Defaults” line, in /etc/sudoers.

$ sudo su
# grep Defaults /etc/sudoers
Defaults env_reset

Make the Defaults line to look like this:

# grep Defaults /etc/sudoers
Defaults env_reset,timestamp_timeout=10

timestamp_timeout=0 (zero) makes the sudo password expire every 0 (zero) seconds. This means that every time you use sudo, you will be asked for the password.

timestamp_timeout=-1 (minus one) makes the sudo password not expire.

Tagged with: , , , , , ,
Posted in The Linux and Unix Articles!

Leave a Reply

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

*

Subscribe

  

Subscribe to get the latest Linux news and how to guides directly on your e-mail!