Rsync via SSH running as a cron job - permissions failure problem
I have a script that goes seomthing like:
#!/bin/sh
today=`date +%Y-%m-%d_%H:%M`
echo "================ BEGIN FILE BACKUP AT "$today" ==================="
rsync -vauze 'ssh -p 522' root@myserver.co.uk:/backup/*.gz /Volumes/Work/vpsbackups
I am trying to run this through a crontab :
* * * * sh /Users/mine/scripts/vpshomedir > /Users/mine/scripts/vpshomedir.log 2>&1
But I am getting the following in the logfile
Permission denied (publickey,gssapi-with-mic,password).
rsync: connection unexpectedly closed (0 bytes received so far) receiver
rsync error: unexplained error (code 255) at /SourceCache/rsync/rsync-35.2/rsync/io.c(452) http://receiver=2.6.9
I expect this is due to environment variables, maybe SSH AUTHSOCK, not being available when run through cron - as the script works fine when I run it from a terminal session...
Can anyone help me out here, as I haven't a clue where to add the necessary arguments to the crontab entry or script - only been scripting unix/linux for 6hrs, so please be noob friendly.
Thanks.
iMac Nov 2007, Mac OS X (10.5.1), It's spelt - Aluminium