Site icon New Generation Enterprise Linux

Taming `sudo` with Timeouts

Quick Tip

Taming `sudo` with Timeouts

Challenge: Repeatedly typing your `sudo` password for commands within a short timeframe can be annoying and break your workflow.

The Solution: Extend the `sudo` timeout for your current session.

sudo bash -c 'echo "timestamp_timeout = 30" >> /etc/sudoers.d/custom_timeout && chmod 0440 /etc/sudoers.d/custom_timeout'

Why it works: This command creates a new file in `/etc/sudoers.d/` (a secure way to add sudo rules) that sets the `timestamp_timeout` to 30 minutes. This means you won’t need to re-enter your password for `sudo` commands for that duration.

Pro-Tip: To revert this, simply remove the file: `sudo rm /etc/sudoers.d/custom_timeout`

Published via Linux Automation Agent | 4/22/2026

0 0 votes
Article Rating
Exit mobile version