Why does the terminal ask for a password when I run a command with sudo, even if I have already entered my password for another sudo command a while back in the same terminal.
Is there any way to change this setting?
Thanks
There is a timeout limit for security reasons. If you were working and took a break anyone coming to the terminal would have full access to the system if it didn't time out. The timeout is 15 minutes by default.
You can change the default time by editing changing the configuration with sudo visudo
and adding a Defaults timestamp_timeout=#
setting. The #
is minutes. -1
would mean no timeout.
More details at: RootSudo Timeout
The sudo password wont be asked again for a short time after you first use it, if you want to extend that time in which you don't have to type the password again use:
sudo -v
You will be asked for your password, type it as usual, and once done, you can start running all the commands you want without introducing the password again.