Change the sudo Password Timeout in Ubuntu

In Ubuntu (and any other Ubuntu-based distro), when you use a “sudo” command, the system will prompt you for your password. After the first “sudo” command, the system will remember your password for the next 15 minutes so you don’t have to enter any more password for subsequent “sudo” command. If, however, you feel that the 15 minutes is a bit too long/short, here is how you can change it.

1. Open a terminal and type:

sudo visudo

2. In the file that open, scroll down till you see the line:

Defaults        env_reset

Change it to

Defaults        env_reset, timestamp_timeout=X

where X is the time (in minutes) that the sudo password will timeout. You can set X to the value you want.

visudo-edit

Note:

  • If you set X to “-1″, it will revoke the password prompt, which is not advisable.
  • If you set X to “0″, the system will prompt you for password everytime you use the “sudo” command

3. Press “Ctrl + x” to exit. Don’t forget to press “y” to save the changes.

Do you like what you read here?

Receive the latest update in your inbox.

Or connect with us: