How To Change Sudo Password Timeout In Ubuntu

In Ubuntu Linux system, whenever you run a command with sudo, you will be prompted to enter the sudo password. After a short period of time, you don’t have to enter the password, even if you run any sudo command. Because sudo remembers your password for 15 minutes by default. After 15 minutes, you will be asked to enter the password again for any sudo command. But you can also change this sudo password timeout limit using below methods.

Change Sudo Password Timeout

Open the terminal app (ctrl+alt+t) and run below command. It will open the /etc/sudoers file in nano editor.

sudo visudo

Now add ” timestamp_timeout=60″ (place cursor using arrow keys and start typing or copy paste) in “Defaults env_reset” line like below.

Defaults env_reset, timestamp_timeout=60

Change Sudo Password Timeout

After that press Ctrl+X keys followed by Y to save the changes and close the nano editor. And restart Ubuntu. Now it will change your Sudo Password Timeout to 60 minutes. You can just replace the 60 with your required time. That’s all.

If you liked this article, please subscribe to our YouTube Channel. You can also stay connected with us on X (Twitter) and Facebook.



Also Read:  How to Install and Configure Z Shell ZSH on Ubuntu

Leave a Reply