使用ssh配置时将rsync用作cron作业

时间:2018-06-28 07:15:39

标签: ssh cron rsync

我的cron工作是

rsync -azvvh --exclude-from '/home/user/Desktop/abacus/exclude_list.txt' abacus:/home/hiv/user/ /home/user/Desktop/abacus

我的ssh配置文件

Host abacus
     HostName abacus
     user username

我还设置了ssh密钥Auth。所以当我这样做

ssh abacus

它直接将我登录到远程服务器。

问题是当cron运行rsync作业时它不起作用

错误是

Last failed login: Thu Jun 28 11:51:02 2018 from *.*.*.* on ssh:notty
There were 2 failed login attempts since the last successful login.

尝试1-相同的错误

rsync -azvvh --exclude-from '/home/user/Desktop/abacus/exclude_list.txt' -e "/home/user/.ssh/id_rsa" abacus:/home/hiv/user/ /home/user/Desktop/abacus

尝试2-相同的错误

Host abacus
    HostName abacus
    user rohit.modee
    IdentityFile ~/.ssh/id_rsa

0 个答案:

没有答案