> ## Content Index
> Fetch the complete content index at: https://itsfoss.com/llms.txt
> Use this file to discover other available public pages before exploring further.

# Change the Sudo Password Timeout in Ubuntu
- URL: https://itsfoss.com/change-sudo-password-timeout-ubuntu/
- Published: 2013-08-23T00:20:20.000Z
- Updated: 2024-02-27T12:59:23.000Z
- Description: Changing sudo password in Ubuntu is one thing, but did you know you can change the sudo timeout as well? This article teaches you that.
- Author: Abhishek Prakash
- Tags: Quick Tip

If you frequently use the terminal in Ubuntu, you must have faced the following situation:

You use [sudo](https://en.wikipedia.org/wiki/Sudo?ref=itsfoss.com) 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 systems for using sudo. 

In Ubuntu, this default sudo timeout is 15 minutes. If you think 15 minutes is too short or too long, you can even **change the sudo password timeout in Ubuntu**. And with this quick tip, I am going to show you how to do this.

## Change sudo password timeout in Ubuntu

✋

The same method should work on other Linux distributions too. It's just that the default editor may not be Nano and thus the save and exit keyboard shortcuts maybe different.

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

```
sudo visudo
```

It will open a file in the [nano text editor](http://www.nano-editor.org/?ref=itsfoss.com) that contains some settings related to sudo. In here, look for the following line:

```
Defaults        env_reset
```

Replace the above line with this one:

```
Defaults        env_reset, timestamp_timeout=XX
```

Where “*XX*” is the new timeout value in minutes, enter the desired timeout duration there as shown below. 👇

![a screenshot of nano with the sudo timeout being changed](https://itsfoss.com/content/images/2023/12/Change_sudo_Timeout.png)

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

![a screenshot of nano with the sudo timeout changes being confirmed](https://itsfoss.com/content/images/2023/12/Change_sudo_Timeout_2.png)

And Voilà! That was a quick and easy tip to change the sudo password timeout in Ubuntu.

*💬 Was it not fun? Any questions, suggestions, or other fun tips are welcome. Ciao 😄*

## Suggested further reads 📖

Improve your Nano knowledge if you are not familiar with it.

[Editing Files With Nano in Linux \[With Cheat Sheet\]Though Nano is less complicated to use than Vim and Emacs, it doesn’t mean Nano cannot be overwhelming. Learn how to use the Nano text editor.![](https://itsfoss.com/content/images/size/w256h256/2022/12/android-chrome-192x192.png)It's FOSSAbhishek Prakash![](https://itsfoss.com/content/images/wordpress/2020/05/nano-editor-guide.png)](https://itsfoss.com/nano-editor-guide/)

Explore more sudo tips here.

[7 Ways to Tweak Sudo Command in LinuxUnleash the power of sudo with these tips 💪![](https://itsfoss.com/content/images/size/w256h256/2022/12/android-chrome-192x192.png)It's FOSSAbhishek Prakash![](https://itsfoss.com/content/images/2023/12/sudo-tips-and-tricks.png)](https://itsfoss.com/sudo-tips/)