After reading Vivek Gite's article on passwordless SSH access for backup scripts, I modified his scripts
My scripts are hobby scripts aimed at home usage.
The idea with sourcing another users keychain files and using sudo is avoiding root login over SSH.
One caveat is that this other user may not have reading permissions for some files and directories.
For example, the user per cannot read /etc/sudoers.d/ which has to be copied manually doing this
The lines with echo are because of MAILTO (when the backup has been done, cron mails me).I am not sure whether this approach actually works, but this server is up on and off when I am not