Change Sudo password timeout and increase sudo password remember time. Users can change Sudo timeout on Ubuntu. On Ubuntu, increase Sudo password timeout – how long Sudo waits before it asks password again.
By default, when you run sudo in Ubuntu Linux Systems, the administrative privileges last for only 15 minutes or until the Terminal is closed. So after 15 minutes you will have to type in your password with every command. Luckily this can be changed and the Sudo password timeout can easily be edited. Let us see how?
Change Sudo password timeout
To Change Sudo password timeout, open Terminal (press Ctrl+Alt+T) and run the command given below to edit the config file:
sudo visudo
Once the file is opened, scroll down and find out “Defaults env_reset“. This is the command entry that defines the default environment reset time for Sudo. Change it into “Defaults env_reset , timestamp_timeout=X“, where X is the number of minutes after which the sudo password expires. SO if you want to retain the administrative privileges for 30 minutes, replace X with 30. Please note that if you set the time to 0, the Sudo password will always be required to run every single command. Also remember to save the changes.