Jireh程序猿的那些事 Jireh程序猿的那些事

记录分享生活、程序、信息的精彩人生

目录
Mac下清除SSH密钥缓存
/  

Mac下清除SSH密钥缓存

下午连 SSH 的时候发现连接不上了

JirehdeMacBook-Pro:~ jireh$ ssh root@xxx.xxx.xxx.xxx
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@    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:6X749AzRgZtBAG2ftdGaf0BAhdpqZoRhnevPJhXR1z0.
Please contact your system administrator.
Add correct host key in /Users/jireh/.ssh/known_hosts to get rid of this message.
Offending ECDSA key in /Users/jireh/.ssh/known_hosts:2
ECDSA host key for xxx.xxx.xxx.xxx has changed and you have requested strict checking.
Host key verification failed.

想想可能是根据自己刚才,重装了系统导致,结果 SSH 使用旧密钥连接,但是服务器已经更新了所以连接不上。

查了下资料可以在终端中输入

ssh-keygen -R xxx.xxx.xxx.xxx | 这里 xxx.xxx.xxx.xxx 就是你服务器的 IP 地址

这样就可以清除啦。


如果觉得这篇文章不错的话,请我喝一杯 咖啡☕吧
标题:Mac下清除SSH密钥缓存
作者:Jireh
地址:http://jireh.xyz/articles/2020/03/10/1583805360362.html
本作品由 Jireh 采用 署名 – 非商业性使用 – 禁止演绎 4.0 国际许可协议进行许可,转载请注明出处。