Rsync fails due to Sudo timeout I am trying to run a lengthy Rsync (local machine only, no ssh, no lan or wan connects involved) but Sudo is timing out and the script fails. Total runtime of the command is about 20 mins. What is the recommend way to either lengthen the Sudo timeout or disable Sudo from that particular command only? I am the admin of this system but do not log in as root.
Thank you in advance.
How are you actually invoking the script? If you run a script like sudo script.sh, all commands inside the script are run as superuser and you should never have it time out. If you're running a script that has sudo commands inside it, then it could ask for a password more than once if it takes too long between sudo commands. The sudo timeout only applies to new invocations of the sudo command. If your case is the latter, you do have the option of using the command sudo -v in your script which will extend the timeout by its default value (normally 5 minutes, but see below for how to change it), but if everything inside needs superuser permissions anyways, it makes more sense to invoke the entire script with sudo.

If you do want to change the sudo time out, you need to edit the sudoers file:


Bring up the sudoers file:

sudo visudo

Find the line that starts with:

Defaults    env_reset

Add a comma and the command timestamp_timeout=minutes to the end
(replace minutes with the number of minutes desired, 0 will always
ask for a password, a negative number will never time out -
dangerous):

Defaults    env_reset,timestamp_timeout=10

Save and close the file.