Dear community,
I'm driving crazy with a strange issue.
I have a simple script to transfer a file to a remote system:
Between client and server there is a SSH KEY, so if I run the script from root terminal, the file is correctly transferred.
Now, I edit the root crontab to automatically execute this script, but the trasfer fails!! :wall:
Seems the SSH KEY doesn't work from root cron, because every time the script runs, the system send me the following mail:
Please, could someone explain me why from terminal works and from crontab doesn't work? :(
Many thanks
Lucas
I'm driving crazy with a strange issue.
I have a simple script to transfer a file to a remote system:
Code:
#!/bin/bash
echo "put /tmp/server.log" > /tmp/server1_transfer.sftp
sftp -b /tmp/server1_transfer.sftp user@10.99.1.2:
Now, I edit the root crontab to automatically execute this script, but the trasfer fails!! :wall:
Seems the SSH KEY doesn't work from root cron, because every time the script runs, the system send me the following mail:
Code:
Received: (from root@localhost)
by xyz (8.13.8/8.13.8/Submit) id q7GGv1qv022647;
Thu, 16 Aug 2012 18:57:01 +0200
Date: Thu, 16 Aug 2012 18:57:01 +0200
Message-Id: <201208161657.q7GGv1qv022647@xyz>
From: root@xyz (Cron Daemon)
To: root@xyz
Subject: Cron <root@xyz1> /tmp/test.sh
Content-Type: text/plain; charset=ANSI_X3.4-1968
Auto-Submitted: auto-generated
X-Cron-Env: <SHELL=/bin/sh>
X-Cron-Env: <HOME=/root>
X-Cron-Env: <PATH=/usr/bin:/bin>
X-Cron-Env: <LOGNAME=root>
X-Cron-Env: <USER=root>
Permission denied, please try again.
Permission denied, please try again.
Permission denied (publickey).
Many thanks
Lucas