背景信息
- 在云平台创建一台centos实例,选择ssh密钥方式认证登录
- 本地MAC terminal上成功远程登录一次
- centos实例重装操作系统,重装后系统还是centos
- 再次使用同一台MAC terminal远程登录,登录失败
报错信息
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ 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 ED25519 key sent by the remote host is
SHA256:ctpjS7pkHkC+IDZk8Gro1ZvSbwVd3vUhnUlT732+Ojg.
Please contact your system administrator.
Add correct host key in /Users/bytedance/.ssh/known_hosts to get rid of this message.
Offending ECDSA key in /Users/bytedance/.ssh/known_hosts:6
Host key for 180.18x.193.xx has changed and you have requested strict checking.
Host key verification failed.
解决办法
-
在MAC terminal中打开如下文件,
vi . /Users/bytedance/.ssh/known_hosts
该路径是我的mac中的路径,在使用时需要把“bytedance”替换为你们的本机地址 -
删除文件中的所有内容,保存
-
重新用ssh密钥远程登录centos实例,成功解决