- Published on
How long is the `sudo` password timeout?
- Authors

- Name
- hwahyeon
I discovered that after using a sudo command and entering the password, the system doesn’t ask for the password again for a few minutes. I’d like to know the exact duration and what’s happening behind the curtain.
According to various articles, this period is typically 10-15 minutes. To check or adjust this time exactly, you can refer to the /etc/sudoers file and look for the timestamp_timeout option.
Defaults timestamp_timeout=15
- Here,
15means 15 minutes. If you set it to10, the duration will be 10 minutes. - If you set it to
0, you will need to enter the password every time you usesudo. - If you set it to
-1, you will only need to enter the password once, and it won’t ask again until the system is rebooted.
Additionally, there’s another option in /etc/sudoers that allows you to bypass the password prompt entirely. By adding the following line:
username ALL=(ALL) NOPASSWD: ALL
This will allow the specified user to use sudo without entering a password.
References: