By default sudo remembers your password for 15 minutes.

Disable sudo timeout with this command:

sudo sh -c 'echo "\nDefaults timestamp_timeout=-1">>/etc/sudoers'

To re-enable sudo timeout use this command:

sudo sed -i "/Defaults timestamp_timeout=-1/d" /etc/sudoers

You can also change or disable sudo timeout with visudo.

sudo visudo

This opens an editor and points it to the sudoers file — Ubuntu defaults to nano, other systems use Vi.

To the defaults line, add :

timestamp_timeout=2

So it will look like this:

Defaults env_reset,timestamp_timeout=20

You might want to read the sudoers manual pages for additional information.

man sudoers

 

Subscribe To Our Newsletter

Subscribe To Our Newsletter

Join our mailing list to receive the latest news and updates from our team.

You have Successfully Subscribed!