Published on: April 6, 2016 by Manu M.
I am back with another sudo tweak 😉 . This time I am trying to avoid frequent password requirements while doing sudo by changing the sudo password interval time.
As a Linux user sudoing will be familiar with every one. When run sudo command for the first time it will ask for our password. Now have you noticed that in some systems when you run the sudo command second time it asks for password and in other system it won’t.
This left me bewildered. So I went after it to find why this is happening and landed up with this tweak 🙂
So let’s get started.
What are we trying to do here?
We will be increasing the time interval for password prompt. So once we provide password when running sudo, it won’t ask you password if you run another sudo command within that time interval.
How to do this?
First we open the “/etc/sudoers” file and change a setting to customize the length of the grace period. Run following command
Enter your password when prompted and the file is opened. Now search for following
Edit it to look like
Defaults env_reset, timestamp_timeout=x
“x” is the number of minutes you want sudo to wait in the same Terminal session before prompting you to enter your password again.
Now save the file, close the terminal and open a new one. From now on once you provide password for a sudo command it will not prompt you for password for next “x” minutes.
Don’t edit /etc/sudoers file directly in any other editor. run sudo visudo to edit it.
Category : Howtos, Linux