crontab run rsync: Host key verification failed

| | Comments (0)

在 FreeBSD 下用 root 直接跑下面的指令(已和 host 建好 authorized_keys)
rsync -avz -e ssh host:/remotedir /localdir

放到 crontab 使用 root 執行, 卻會出現如下錯誤
WARNING: RSA key found for host
in /root/.ssh/known_hosts:16
RSA key fingerprint 12:34:56:78:90:92:02:5d:e5:bb:9b:c2:0e:cb:00:ff.
Host key verification failed.
rsync: connection unexpectedly closed (0 bytes read so far)
rsync error: error in rsync protocol data stream (code 12) at io.c(348)

查了許久, 終於找到答案: console 下用的 ssh 和 crontab 下用的 ssh 不一樣

由於我有另外裝 OpenSSH
在 console 下 /usr/local/bin 的 path 排前面, 使用 /usr/local/bin
crontab 下 /usr/local/bin 的 path 排前面, 使用 /usr/bin
freebsd 內建的 /usr/bin/ssh 會使用 DSA key fingerprint
OpenSSH 會使用 /usr/local/bin/ssh 會使用 RSA key fingerprint
所以才會產生 Host key verification failed. 的問題

Leave a comment

March 2009

Sun Mon Tue Wed Thu Fri Sat
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 31        

About this Entry

This page contains a single entry by Pank published on November 30, 2004 2:39 PM. Defaced was the previous entry in this blog.

Gaim buddy icon is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.