How To Change The Sudo Password Timeout In Ubuntu

CHanging default sudo password timeout in Ubuntu

Changing sudo password in Ubuntu is one thing but did you know you can change sudo timeout as well? This article teaches you that.

IF you frequently use the terminal in Ubuntu, you must have faced this situation.

You use sudo for some command in the terminal, it asks for the password. You enter the password, the command runs. For the subsequent commands, even if they need superuser privileges, you don’t need to enter the password again.

After a certain amount of time, when you try to use sudo, it asks for the password again.

It happens because there is a default timeout in Ubuntu and other Linux system for Sudo. In Ubuntu, this default sudo timeout is 15 minutes. If you think 15 minute is too short or too long you can even change the sudo password timeout in Ubuntu. And in this quick tip, I am going to show you how to do this.

Change sudo password timeout in Ubuntu:

Changing the default sudo password timeout in Ubuntu is very easy. Even beginners can do it. All you have to do is to open a terminal (Ctrl+Alt+T) and use the following command:

sudo visudo

It will open a file in nano text editor that contains some settings related to sudo. In here look for the following line:

Defaults        env_reset

Replace above line with this one:

Defaults        env_reset, timestamp_timeout=XX

Where XX is the new timeout value in minutes. Of course you have to replace the XX with the desired timeout value.

Change sudo password timeout in Ubuntu

Once you are done changing the default sudo password timeout, use Ctrl+X to exit the editor. It will give you option to save or cancel the changes. Use Y to save the changes.

Voila! A quick and easy tip to change the sudo password timeout in Ubuntu.

Was it not fun? Any questions, suggestions or some fun tips are welcomed. Ciao :)

Similar Posts