To set the sudo password timeout value, use the passwd_timeout parameter. First, open the /etc/sudoers file with superuser privileges using sudo and visudo commands like so:

$ sudo visudo 

 

Then add the following defaults entry, it implies that the sudo password prompt will time out after 20 minutes once sudo is invoked by a user.

Defaults        env_reset,timestamp_timeout=20

 

Note: You can set whatever time you want in minutes and make sure to wait before it times out. You can also set time to 0 if you want a password prompt for every sudo commands you execute or disable password prompt forever by setting the value -1.

 

The defaults parameters have set in my /etc/sudoers file.

 

Save the file by pressing [Ctrl + O] and exit using [Ctrl + X]. Afterwards, test if the setting is working by running a command with sudo and wait for 2 minutes to see if the password prompt will time out.

Bu cavab sizə kömək etdi? 0 istifadəçi bunu faydalı hesab edir (0 səs)