今天處理 ssh連接至 ubuntu 服務(wù)器時(shí)岸霹,提示以下錯(cuò)誤:
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ 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.
經(jīng)過(guò)google,出現(xiàn)這個(gè)問(wèn)題的原因是,第一次使用SSH連接時(shí)雪猪,會(huì)生成一個(gè)認(rèn)證,儲(chǔ)存在客戶端的known_hosts中乘碑。
可使用以下指令查看:
ssh-keygen -l -f ~/.ssh/known_hosts
由于服務(wù)器重新安裝系統(tǒng)了,所以會(huì)出現(xiàn)以上錯(cuò)誤。
解決辦法
ssh-keygen -R 服務(wù)器端的ip地址
會(huì)出現(xiàn)以下提示:
# Host [服務(wù)器IP] found: line 1 type RSA
/用戶home目錄/.ssh/known_hosts updated.
Original contents retained as /用戶home目錄/.ssh/known_hosts.old
重新連線,出現(xiàn)以下提示:
The authenticity of host '[服務(wù)器IP] (服務(wù)器IP)' can't be established.
RSA key fingerprint is da:f7:3e:ba:f7:00:e6:44:76:f2:58:6e:48:****.
Are you sure you want to continue connecting (yes/no)?
輸入yes確認(rèn)即可連線成功。