We sometime might feel like the sudo effect should stay for more than default 5 minutes in terminal to run multiple commands without getting password prompt. We can increase or decrease the sudo effect duration by modifying the time stamp.
Note : It is advised not to change the default time stamp of 5 minutes as this might create security concerns. If you want to still increase the time stamp then follow below steps to increase/decrease.
- Open Terminal.
- Run command visudo in Terminal. (This will open /etc/sudoers file , Do not use any other method to open this file as this will corrupt the file, resulting in unexpected results)
- Edit the file in insert mode and write following line at the end of the file
Defaults env_reset,timestamp_timeout=60
Where 60 refers to 60 minutes.
Note : 1. If you set the timeout to 0, you will be always prompted for a password.
2. If you set to a value less than 0 then user's timestamp will never expire.
Nice Tip! Thanks for sharing...
ReplyDelete