Wednesday, November 3, 2010

How to extend sudo's timeout in Ubuntu

If you're wondering what this is about, then here is the scenario.

You open your terminal and try to execute some privileged commands and you got to add sudo to it. Like, for example, when you have to change permissions you use 'sudo chmod 777 file.txt'. And then it asks for your password. But once you do it, it won't ask you for the password for the 'sudo' commands that you enter in the next 5 minutes. 5 minutes is the default timeout period for which time the terminal is going to remember your password. If you want to extend it then here's how.

You need to edit the sudoers.tmp file. For that, go to your terminal and type this :
gksudo gedit /etc/sudoers
Find the line that says :
Defaults evn_reset
Change it into
Defaults evn_reset , timestamp_timeout=x
where x is the timeout period in minutes.

If you want your terminal to remember your password for as long as you are not logged out or close window, then keep the value of x as -1.

No comments:

Post a Comment