Bill East on 14 Apr 2012 15:05:09 -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:53 PM, David Coulson <david@davidcoulson.net> wrote:
Does running the script from cron work, rather than ssh directly?


 David, if I understand you correctly, at the moment I'm running a script that contains the ssh command. I also prepended an 'env' command to the script just to find out the path and system variables:

CONSOLE=/dev/console
TERM=linux
SHELL=/bin/sh
USER=sqldmp
INIT_VERSION=sysvinit-2.84
AUTOBOOT=YES
PATH=/sbin:/bin:/usr/sbin:/usr
/bin
RUNLEVEL=3
_=/usr/bin/env
PWD=/home/sqldmp
PREVLEVEL=N
SHLVL=3
HOME=/home/sqldmp
BOOT_IMAGE=Linux

It's interesting that the SHELL shows as /bin/sh when I am using a hashbang in the script of /usr/bin/bash. Huh.


On 4/14/12 5:42 PM, Bill East 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.

So... /usr/bin/ssh is set to 755. I don't see anything in /etc/ssh/ssh_config that would prohibit cron from running it. The cron daemon itself is running as root - it's Dillon's crond if that's important.

Thoughts? Is this so painfully obvious I just can't see it?

Thanks


___________________________________________________________________________
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

___________________________________________________________________________
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