Ubuntu 16.04 rsync via ssh prompts me for password, how to make it a cron job?

Solution 1:

This should do it:

sudo rsync -e 'ssh -i /path/to/pi's/id_rsa' -aAXv / --delete --ignore-errors --exclude={"/dev/*","/proc/*","/sys/*","/tmp/*","/run/*","/m‌​nt/*","/media/*","/l‌​ost+found"} pi@prime:/mnt/solar