How To Change The SUDO Password Time-out In Ubuntu

The first time you run a command with "sudo" in Ubuntu, you are asked for a password but after running one more command with "sudo" (after a short while), you are not prompted for a password again.

That's because "sudo" has a default password time-out.

Here is a tip to set the exact time-out for "sudo" password remembering in Ubuntu.

Open a terminal and type:

# sudo visudo

Then scroll to the line that says:

Defaults env_reset

and edit it so that it looks like this:

Defaults env_reset , timestamp_timeout=X

Where X is the number of minutes after which the password should expire, so set it to whatever you want. If you set it to 0, the password will always be required.


Once you're done editing the file, press Ctrl + X, type "y" (yes), press ENTER and that's it.