I'm running on a Mac, and I want to set up a crontab to rsync from my VPS on a weekly basis to grab some backup archives. I'm using ssh keys (no passwords allowed on the VPS), and normally I can ssh in without any prompts (my private key has a passphrase but it's stored in the Mac keychain). However, when cron runs a script, it fails and emails me saying that ssh failed:
Permission denied (publickey). rsync: connection unexpectedly closed (0 bytes received so far) [receiver] rsync error: unexplained error (code 255) at /SourceCache/rsync/rsync-42/rsync/io.c(452) [receiver=2.6.9]
The script being executed:
#!/bin/sh rsync -Cavz -e "ssh -i /Users/bob/.ssh/id_rsa" bob@myvps:/backups/ ~/Documents/Backups
What am I doing wrong?