Linux security

How to change SUDO password timeout in Linux

Some Linux orders require Administrator privilege for execution of certain scripts or tasks in Linux. However, the default for the administrative permissions whene you issue a sudo lasts only 15 minutes. There are cases where you would prefer this timeout to be longer so you are not forced for password at the next command so quickly.

Good thing is, this is easy to fix, you have option to increase or decrease this timeout for a sudo in your Linux distribution. Here are the steps:

Open your terminal  and run following command

$ sudo visudo

Once you opened the file, scroll and change this line from 15 to 30

Defaults        env_reset,timestamp_timeout=30

If you want a password prompt for every sudo command you execute set timestamp_timeout=0
If you want to disable sudo password prompt forever, set it to timestamp_timeout=1

Save and close the file by entering Ctrl+O and exit using Ctrl+X.

The changes should be applied immediately. Run a sudo command, enter the password for first time and execute it. Wait for a 2-3 minutes and run the command again. This time you will not be asked for password.

Leave a Reply