2

Is it possible that the same opened terminal (default in ubuntu) will ask for the sudo password from time to time after being provided a password at some point?. E.g.:

  $ sudo service my_service_name restart
  [sudo] password for my_username:
  $ sudo service my_service_name restart
  $ sudo service my_service_name restart
  [sudo] password for my_username: <-- again asking for password

1 Answers1

4

In Ubuntu, the default sudo timeout is 15 minutes. If you think 15 minutes is too short or too long, you can change it by editing /etc/sudoers and adding this line there, 5 is the new timeout value in minutes:

Defaults timestamp_timeout=5
  • If you specify 0, you will always be asked for password.
  • If you specify a negative value, the timeout will never expire.
  • The timeout may include a fractional component if minute granularity is insufficient, for example 2.5.

To edit /etc/sudoers, I highly recommend using sudo visudo instead of editing the file directly. visudo runs sanity checks and tests for parse errors, preventing you from locking yourself out of sudo.

sotirov
  • 4,379