I find that if I execute something using sudo that then if I execute something else soon after also using sudo, that it does not prompt me for my password, and although this can be inconvenient in some situations, it is a security risk in others, and a hassle to keep on coming back and executing the command to make it prompt your for the password on the next go. So I was wondering if and how I could get it to prompt me every time, or for it to at least only remember my password for a very short amount of time?
Asked
Active
Viewed 3.3k times
13
2 Answers
18
Open Terminal and type:
sudo visudo
Then scroll down to the line that reads:
Defaults env_reset
And change it to:
Defaults env_reset,timestamp_timeout=0
You can change 0 to any values (time in minutes). Setting it to 0 will ask for your password every time and -1 will make it never ask. The default is 15 according to man sudo 8, but some manuals say the default is 5. Have a look at the RootSudoTimeout wiki for more information.
Press CTRL + X to finish editing, Y to save changes, and ENTER to exit.
Ron
- 20,938
0
From Terminal run:
echo "testuser1 ALL=(ALL) PASSWD: ALL" >> /etc/sudoers
Or:
visudo -f /etc/sudoers
Add the following line at the bottom of the file:
testuser1 ALL=(ALL) PASSWD: ALL
muru
- 207,228