报错信息
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ 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:xxxxxxxxxxxxxxxxxx.
Please contact your system administrator.
Add correct host key in /Users/wusiqi/.ssh/known_hosts to get rid of this message.
Offending RSA key in /Users/wusiqi/.ssh/known_hosts:6
RSA host key for [服务器ip] has changed and you have requested strict checking.
Host key verification failed.
原因
因为第一次SSH连接时,会生成一个认证,储存在Mac的known_hosts里,因为我的服务器前几天重装了系统。
导致服务器端与客户端认证信息不同,就报了这个错误。
解决方法
把之前的认证信息删掉,重新ssh连接的时候生成新的。
打开终端,输入
vi ~/.ssh/known_hosts
找到服务器的ip,把相关信息删除后保存即可。
接下来重新连接服务器,会出现
Are you sure you want to continue connecting (yes/no)?
输入yes,回车后,就能成功连接服务器,同时新的认证信息就保存啦。