Ssh

SSH 錯誤:警告:遠端主機標識已更改!

  • April 16, 2015

我執行了 rsync (cygwin) 並得到了這個錯誤。我認為他們昨晚將 Red Hat Linux 作業系統從版本 5 更改為版本 6。這會是此錯誤消息的原因嗎?我需要做什麼來解決這個問題?我記得,sysadm 在他設置 cygwin 後在我的電腦上執行了一個名為 ssh-keygen 的命令。我要重新執行它並將文件複製到 RH6 伺服器嗎?

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@    WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!     @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that a host key has just been changed.
The fingerprint for the RSA key sent by the remote host is
xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx.
Please contact your system administrator.
Add correct host key in /home/xxxxx/.ssh/known_hosts to get rid of this message.
Offending RSA key in /home/xxxxx/.ssh/known_hosts:2
RSA host key for xxxxx has changed and you have requested strict checking.
Host key verification failed.
rsync: connection unexpectedly closed (0 bytes received so far) [Receiver]
rsync error: unexplained error (code 255) at /home/lapo/package/rsync-3.0.9-1/src/rsync-3.0.9/io.c(605) [Receiver=3.0.9]

假設您相信主機確實更改了主機密鑰,您可以刪除舊條目。因為這個告訴你舊條目在第 2 行,你可以這樣做

sed -i -e '2d' ~/.ssh/known_hosts

從您已知的主機文件中刪除舊條目

引用自:https://unix.stackexchange.com/questions/196630