云服务器重装系统后重连报错:REMOTE HOST IDENTIFICATION HAS CHANGED

最近遇到一个场景,需要对已配置 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 ED25519 key sent by the remote host is
SHA256:wLaJC0+zi/FQtY6mjpLYUj9Mezx8swi51khYEG4xPzA.
Please contact your system administrator.
Add correct host key in /Users/jason315/.ssh/known_hosts to get rid of this message.
Offending ECDSA key in /Users/jason315/.ssh/known_hosts:11
Host key for 1.116.xxx.xxx has changed and you have requested strict checking.
Host key verification failed.

从提示信息可知,由于重装了系统,SSH 的认证信息已经变更了

可以用如下命令重新生成

ssh-keygen -R ecsPublicIP

重新连接,遇到提示 Are you sure you want to continue connecting (yes/no/[fingerprint])? 时直接输入 yes 即可,此时会生成新的认证信息,并将之前的认证信息保存到 ~/.ssh/known_hosts.old 中

重新连接成功

猜你喜欢

转载自blog.csdn.net/u013481793/article/details/128242470