首先跟大家说一下我的遇到的问题,有一台虚拟机服务器重新装了系统ip:12.29.2.3,由于服务器12.29.2.3出问题了重新装了系统,本地Mac (如果是其他的linux系统一样)使用ssh方式内网登录12.29.2.3时会报错,主要原因是因为本地访问过12.29.2.3的服务器,会把服务器(12.29.2.3)登录标识证书记录下来,下次登录时会去比对之前的记录,由于系统重装标识变了导致不能继续登录。
解决方案是在客户端执行命令,清除本地缓存的证书:
ssh-keygen -R 12.29.2.3
12.29.2.3 :为要登录的服务器ip
原始错误如下:
$ scp ~/some.zip root@12.29.2.3:~
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ 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:
Please contact your system administrator.
Add correct host key in ~/.ssh/known_hosts to get rid of this message.
Offending ECDSA key in ~/.ssh/known_hosts:17
ECDSA host key for 12.29.2.3 has changed and you have requested strict checking.
Host key verification failed.
lost connection