Table of Contents

,

rsync troubleshooting

SSH agent and rsync

Using rsync in crontab of different user than root requires adding additional ENV variables. Example:

PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
SSH_AUTH_SOCK=/run/user/1000/keyring/ssh
53 14 * * * rsync -aq root@example.com:/root/backups/ /home/user/Documents/backups/
30 14 * * 1 rsync -aq root@example.org:/root/backup/* /home/user/Documents/backup/

Trouble with screen program

Add this to .bashrc file if there are issues when running rsync in screen:

if [[ -z "${SSH_CONNECTION}" ]]; then
        export $(gnome-keyring-daemon --start )
fi
 
if [ -S "$SSH_AUTH_SOCK" ] && [ ! -h "$SSH_AUTH_SOCK" ]; then
    ln -sf "$SSH_AUTH_SOCK" ~/.ssh/ssh_auth_sock
fi
export SSH_AUTH_SOCK=~/.ssh/ssh_auth_sock

Tested on

See also

References