我有一个cronjob:
0 9 * * * rsync -a mydir remote_machine:
我用“ crontab -e”安装了它。我有一个ssh-agent运行,当我执行rsync命令本身时,它没有任何用户交互或密码输入即可工作,但是cronjob失败,并显示以下消息:
Date: Wed, 9 Dec 2009 11:11:00 -0600 (CST)
From: Cron Daemon <me@my_machine.my_domain>
To: me@my_machine.my_domain
Subject: Cron <me@my_machine> rsync -a /home/me/mydir remote_machine:
Permission denied, please try again.
Permission denied, please try again.
Permission denied (publickey,gssapi-with-mic,password).
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at /SourceCache/rsync/rsync-35.2/rsync/io.c(452)
[sender=2.6.9]
为什么不起作用?我知道cronjobs以用户身份运行w /我(如果我运行'* * * * * touch / tmp / a'我拥有文件),所以我认为rsync正在使用我的私钥作为我登录...