“WARNING: 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 ECDSA key sent by the remote host is
SHA256:3rzGAFDupq+XohI6PxbwIYYLmtbWPI8s50PVhk/4xeQ.
Please contact your system administrator.
Add correct host key in /c/Users/Administrator.SC-201904061711/.ssh/known_hosts to get rid of this message.
Offending ECDSA key in /c/Users/Administrator.SC-201904061711/.ssh/known_hosts:1
ECDSA host key for class4ever.com has changed and you have requested strict checking.
Host key verification failed.

可以注意一个文件

/c/Users/Administrator.SC-201904061711/.ssh/known_hosts

用编辑器打开这个文件, 可以看到保存了很多服务器的信息, 删掉你不能连接的服务器对应的那行, 然后就可以连接了, 如下图