Blog

Sudo Password Prompt Interval change

Tags: Linuxpasswordsudosudoers

Published on: April 6, 2016 by Manu M.

Sudo Password Prompt Interval change

Scenario:

Hello Guys,

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

sudo visudo

Enter your password when prompted and the file is opened. Now search for following

Defaults       env_reset

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.

Get 24/7 expert server management

Category : Howtos, Linux

Manu M.

Manu M.

Manu has been with us for past one and half years and is a person with good technical skills and domain knowledge. Being a highly athletic personality, Manu likes to play Cricket and Badminton of all games whenever he gets time off. Apart from his technical and athletic abilities, he is a good writer and has tried his hands on penning a few poems of his own. He believes in the mantra that "small things matter the most" and this nature can also visible in his blogs and writings.

You may also read:

Comments

Add new commentSIGN IN

Let's Connect

Get new updates

Categories

$0.000 items