If the sudo
command is not prompting for a password when re-executed a second time, it may be due to the "timestamp_timeout" setting in the sudoers
file. The "timestamp_timeout" setting controls how long the sudo
command will allow a user to execute subsequent sudo
commands without re-entering their password.
By default, the "timestamp_timeout" setting is set to 15 minutes on most systems. This means that if a user executes a sudo
command and then executes another sudo
command within 15 minutes, they will not be prompted for their password again. After 15 minutes have passed, the user will be prompted for their password again when they execute a sudo
command.
If you want to change the "timestamp_timeout" setting, you can do so by editing the sudoers
file. This file is typically located at /etc/sudoers
or /etc/sudoers.d/
. You will need to use the visudo
command to edit the sudoers
file, as it is owned by the root
user and has strict permissions.
To change the "timestamp_timeout" setting, you can use the visudo
command to edit the sudoers
file and find the following line:
sudo visudo
or
cd /etc/sudoers.d sudo visudo -f user_name
add the line:
Defaults timestamp_timeout=30
where 30 is the new timeout in minutes.
To always require a password, set to 0. To set an infinite timeout, set the value to be negative.
To totally disable the prompt for a password for user lautturi:
Defaults:lautturi !authenticate