Rich Freeman on 14 Apr 2012 18:11:30 -0700


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [PLUG] Rsync failing in cron due to ssh permissions


On Sat, Apr 14, 2012 at 5:42 PM, Bill East <wm.east@gmail.com> wrote:
> I've got a simple task, rsyncing a couple of directories. So I first tested
> in command line, then in a shell script, then in cron. The first two...
> worked. The last... didn't. Cron reported "failed to exec ssh - Permission
> denied (13)" So after some fruitless fiddling around I thought to try ssh on
> its own. A shell script that just did 'ssh -vv -l user -i /path/to/key
> destination.domain touch fred.txt'
>
> Again, worked from the command line and the script, failed from cron. I got
> the incredibly helpful cron error:
> /usr/bin/ssh: Permission denied.
>

Your key does not have a password on it, does it?  If so, you need to
provide that password to ssh.  If you are running ssh from the command
line and have an ssh-agent running it could be helpfully providing the
key for you, which cron won't have access to.

Try unsetting SSH_AUTH_SOCK and running the command from the command line.

If that isn't it, I'd try spawning a shell and meticulously setting
the environment to what it would be when invoked by cron, and then
work your way back if that reproduces the problem.

Rich
___________________________________________________________________________
Philadelphia Linux Users Group         --        http://www.phillylinux.org
Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug