I have a very simple cron job written in shell script, which scp a file from another server to local. e.g,
#!/bin/bash scp $REMOTE:/$FILE ./
Of course, the server need a private key to login, which I have config file saving HostName, IdentityFile in (~/.ssh/id_rsa, a mod with 600).
However, it has "permission denied" issue when the cron running....
X-Cron-Env: <SHELL=/bin/sh> X-Cron-Env: <HOME=/home/xxx> X-Cron-Env: <PATH=/usr/bin:/bin> X-Cron-Env: <LOGNAME=xxxx> Message-Id: <20120118235702.33A7B16C03B5@xxx-xxxx-deskbox> Date: Wed, 18 Jan 2012 18:57:02 -0500 (EST) Permission denied (publickey).
I checked everywhere, it says the crontab will be running as the owner/user's environment.
Anyone have a solution for this? Thanks!