Categories: TutorialsUbuntu

How to Change Sudo Password Timeout in Linux

Some Linux commands require administrative privileges for execution. Users without administrative rights can add sudo keyword at the beginning of their command, to temporarily obtain permissions required to execute the command. You can also run sudo command on its own for the same purpose. In both cases, you will be asked for your Linux password to proceed. However, by default, the administrative permissions last only for 15 minutes. It means once you have run sudo command and entered correct password, you can continue to execute administrative commands without having to enter your password or sudo command again, for only 15 minutes. But often you may need to increase or decrease this timeout period. In this article, we will learn how to change sudo password timeout in Linux.

How
Sponsored
to Change Sudo Password Timeout in Linux

Here are the steps to change sudo password timeout in Linux.

1. Open /etc/sudoers

Open terminal and run the following command to open /etc/sudoers file.

$ sudo visudo 

2. Change Sudo Timeout

We need to set the value of timestamp_timeout parameter to the required timeout value. Here is an example to set it to 30 minutes. Add the following line to /etc/sudoers file.

Defaults        env_reset,timestamp_timeout=30

If you want a password prompt for every sudo command you execute set timestamp_timeout to 0. If you want to disable sudo password prompt forever, set it to -1.

Save and close the file by entering Ctrl+O and exit using Ctrl+X.

Sponsored

The changes should be applied immediately. Run a sudo command, enter the password for first time and execute it. Wait for a 2-3 minutes and run the command again. This time you will not be asked for password.

In this article, we have learnt how to change sudo password timeout.

Also read:

How to Reset WordPress Admin Password in MySQL
How to Stop SetInterval Call in JavaScript
How to Store File Content in Shell Variable
How to Sort Array of Objects By Multiple Properties
How to Get Position of Elements in HTML

The post How to Change Sudo Password Timeout in Linux appeared first on Fedingo.

Ubuntu Server Admin

Recent Posts

Cut data center energy costs with bare metal automation

Data centers are popping up everywhere. With the rapid growth of AI, cloud services, streaming…

22 hours ago

Build the future of *craft: announcing Starcraft Bounties!

Our commitment to building a thriving open source community is stronger than ever. We believe…

22 hours ago

NodeJS 18 LTS EOL extended from April 2025 to May 2032 on Ubuntu

The clock was ticking: Node.js 18’s upstream End of Life (EOL) The OpenJS Foundation is…

22 hours ago

Native integration now available for Pure Storage and Canonical LXD

June 25th, 2025 – Canonical, the company behind Ubuntu, and Pure Storage, the IT pioneer…

2 days ago

Revolutionizing Web Page Creation: How Structured Content is Slashing Design and Development Time

Co-authored with Julie Muzina A year ago, during our Madrid Engineering Sprint, we challenged ourselves…

3 days ago

Ubuntu Weekly Newsletter Issue 897

Welcome to the Ubuntu Weekly Newsletter, Issue 897 for the week of June 15 –…

4 days ago