1. 程式人生 > >REMOTE HOST IDENTIFICATION HAS CHANGED 問題解決

REMOTE HOST IDENTIFICATION HAS CHANGED 問題解決

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ 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
da:f7:3e:ba:f7:00:e6:44:76:f2:58:6e:48:******.
Please contact your system administrator.
Add correct host key in /使用者home目錄/.ssh/known_hosts to get rid of this message.
Offending RSA key in /使用者home目錄/.ssh/known_hosts:1
RSA host key for ip地址 has changed and you have requested strict checking.
Host key verification failed.

mac 用ssh 連線時出現的錯誤,

經過google,出現這個問題的原因是,第一次使用SSH連線時,會生成一個認證,儲存在客戶端的known_hosts中

可使用以下指令檢視:

ssh-keygen -l -f ~/.ssh/known_hosts

出現以下提示:

localhost:~ wenwen$ ssh-keygen -l -f ~/.ssh/known_hosts
256 SHA256:+mnJz4ppatNMHmv1RRoTzaU4nNfDDGSILcaCdmsCO1E 39.106.98.62 (ECDSA)
256 SHA256:Hl/dKTFzL4lOlF8DIG5itaV4OAsZunC2AWlFGLjLfsg 211.159.147.77 (ECDSA)
256 SHA256:mEOLvgTuBDNyawROkrrot3O9y77LIPZDVlRcSC4F2KA 123.207.144.194 (ECDSA)

用 以下命令刪除:

ssh-keygen -R 伺服器端的ip地址
localhost:~ wenwen$ ssh-keygen -R 123.207.144.194
# Host 123.207.144.194 found: line 3
/Users/wenwen/.ssh/known_hosts updated.
Original contents retained as /Users/wenwen/.ssh/known_hosts.old

這樣就可以重新連線遠端伺服器了