I would like to use a script to change the sudo timeout of a machine in an automated fashion. Everything I've found online related to changing the sudo timeout is in regards to visudo and manually using an editor to adjust the timeout as follows:

Defaults        env_reset, timestamp_timeout=XX

How can I create this as part of an automated bash script with no user input? Is there a system file I can overwrite? Thanks.

  • 1
    Have you tried /etc/sudo.conf? Mind that if you misconfigure it you may end up disabling it for your own user, and then not being able to fix it easily. visudo does some checking to avoid it. – Zip Dec 1 '19 at 21:49
  • 5
    You should be able to drop a file into /etc/sudoers.d with the Defaults timestamp_timeout=xx setting. – larsks Dec 1 '19 at 22:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.