By default, the timeout period of sudo is 15 minutes, that is to say, within 15 minutes after the last sudo command, you do not need to re-enter the password, and after 15 minutes, you need to re-enter the password. Set sudo timeout To set the sudo timeout, just specify timestamp_timeout=N in the Defaults specification in /etc/sudoers Here N is in minutes, for example, the following configuration sets the timeout to 10 minutes