Changing the sudo timeout in Ubuntu

By default, Ubuntu remembers the sudo login for 15 minutes - this means you won't be prompted for your password for performing sudo operations for 15 minutes following a successful sudo login. This could be risky and can be changed so that the sudo password will be prompted for on every sudo login irrespective of the duration/timeout -
  • Open terminal and type "sudo visudo"
  • Locate the "Defaults ...." line as shown in the image below
  • Add this to the end of the line - ",timestamp_timeout=0"
    • Setting the timeout to 0 will prompt for the sudo password on every login. Alternatively this timeout can also be set to a number - e.g. setting it to 5 will remember the sudo password for 5 minutes.
  • Save the file and exit


Further reference

No comments:

Post a Comment