今天在用终端连接服务器的时候,出现了如下的错误提示:

1
2
3
4
5
6
7
8
9
10
11
12
13
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ 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 RSA key sent by the remote host is
SHA256:uzs+5cJWmOXGWTKo4X1OPjfweGxky7jU/bDAhI5NEac.
Please contact your system administrator.
Add correct host key in /Users/jarman/.ssh/known_hosts to get rid of this message.
Offending RSA key in /Users/guojingman/.ssh/known_hosts:9
RSA host key for 173.22.112.15 has changed and you have requested strict checking.
Host key verification failed.

会出现这个问题是因为,第一次SSH连现时,会生成一个认证,储存在客户端中的known_hosts,但是如果服器端重启后,认证信息也会改变,用原来的客户端连接就会出现如上的错误信息。因此,只要把电脑中的认证信息删除,在此连接后会重新生成,这样就正常啦。要删除很简单,只要在客户端输入命令 ssh-keygen -R 服务器ip