4 months ago

有天我重灌完 NB 後要用 SSH 連線出現下面訊息

zhushanglide-MacBook-Air:~ sam$ ssh 192.168.31.114
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@    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:fO7ZM2C2+EULHR+G+HOfQWMjcT7Fmf0AvP8BKD3I1kc.
Please contact your system administrator.
Add correct host key in /Users/sam/.ssh/known_hosts to get rid of this message.
Offending ECDSA key in /Users/sam/.ssh/known_hosts:20
ECDSA host key for 192.168.31.114 has changed and you have requested strict checking.
Host key verification failed.

原來是 fingerprint 在電腦重灌後會變, 他有個檢查機制避免你被攻擊之類的

簡單一點可可以只更新 目標 IP 的

zhushanglide-MacBook-Air:~ sam$ ssh-keygen -R 192.168.31.114
# Host 192.168.31.114 found: line 20
/Users/sam/.ssh/known_hosts updated.
Original contents retained as /Users/sam/.ssh/known_hosts.old

然後再使用就正常了

zhushanglide-MacBook-Air:~ sam$ ssh 192.168.31.114
The authenticity of host '192.168.31.114 (192.168.31.114)' can't be established.
ECDSA key fingerprint is SHA256:fO7ZM2C2+EULHR+G+HOfQWMjcT7Fmf0AvP8BKD3I1kc.
Are you sure you want to continue connecting (yes/no)?

參考
https://help.dreamhost.com/hc/en-us/articles/217239087-Updating-host-keys

← 如何 使 spring config server 接上 bitbucket 的 git repository NB 安裝 CentOS 闔蓋不休眠 →
 
comments powered by Disqus