Mac下Host key verification failed 解决办法

在重装系统后出现了这个问题

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

"Host key verification failed" 是指 remote host 的 host key 被改变了。
host keys 存在 ~/.ssh/known_hosts.
你可以edit这个file,把旧的host key删掉 或者用这个command来

update:ssh-keygen -R hostname

The authenticity of host 'hostname (hostname)' can't be established.
ECDSA key fingerprint is
SHA256:4Tz7f7UkuVF8LaJNRERmAtS0uUNjQj/l1ITvKyxhU7w.
Are you sure you want to continue connecting (yes/no)? yes

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容