【 Solutions 】移除 offending ssh key
問題
-
使用 ssh 遠端登入時出現下方錯誤訊息
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @ 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 ECDSA key sent by the remote host is SHA256:7utAoyUBxxs0ftPgnrklalsAtkDG8/M6ZPnrFvUxfh4. Please contact your system administrator. Add correct host key in /var/root/.ssh/known_hosts to get rid of this message. Offending ECDSA key in /var/root/.ssh/known_hosts:12 ECDSA host key for 172.20.10.7 has changed and you have requested strict checking. Host key verification failed.
解決方案
-
移除發生問題的 key 紀錄
- 下方訊息告知
/var/root/.ssh/known_hosts
檔案中的第 12 行
造成無法遠端登入,故移除第 12 行的紀錄即可正常運作
-
開啟
/var/root/.ssh/known_hosts
檔案sudo vi /var/root/.ssh/known_hosts
- 檔案內容
- 檔案內容
-
顯示行號
:set number
-
游標移到第 12 行再按
dd
即可刪除此行 -
存檔並離開
:wq!
-
重新登入
- ㊟ 請修改所要登入的機器的 IP
sudo ssh ubuntu@172.20.10.7
- 下方訊息告知