Quick Tip: Adjust sudo Password Timeout Duration

Find yourself entering your password quite often when running a "sudo" command? This is because it only lasts for 15 minutes by default, and can be a bit of nuisance if you're entering commands that are spaced apart from time to time. You can actually adjust this to your liking by making a simple tweak.

sudo-session

  1. Enter "sudo visudo" in the terminal
  2. Scroll down and find the "Defaults env_reset" line
  3. Change it "Defaults env_reset, timestamp_timeout=30" if you want the session to last for 30 minutes
  4. Hold "Ctrl" and hit "X" then press "Y" to save
There are a couple other things you can do to change the behaviour of this like if u set the "timestamp_timeout" to "-1", it won't prompt you for a password (not very secure practice) or if it's set to "0" and it'll ask for one every time.

Bonus: You can do a "sudo -s" that can keep you logged into the session until you close the terminal window.