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:V0EC5keoW7vuMVP3ION9aeYSSV+0z3wiHDEYrZcbOS8.
Please contact your system administrator.
Add correct host key in /home/huanghe/.ssh/known_hosts to get rid of this message.
Offending ECDSA key in /home/huanghe/.ssh/known_hosts:4
remove with:
ssh-keygen -f "/home/huanghe/.ssh/known_hosts" -R 172.10.10.1
ECDSA host key for 172.10.10.1 has changed and you have requested strict checking.
Host key verification failed.
WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!
此报错是由于远程的主机的公钥发生了变化导致的。
ssh服务是通过公钥和私钥来进行连接的,它会把每个曾经访问过计算机或服务器的公钥(public key),记录在~/.ssh/known_hosts 中,当下次访问曾经访问过的计算机或服务器时,ssh就会核对公钥,如果和上次记录的不同,OpenSSH会发出警告。
解决方法
使用命令清除所连接的IP
ssh-keygen -R XX.XX.XX.XX
其中,XX.XX.XX.XX为之前连接时的网段IP
eg.
ssh-keygen -R 172.10.10.1
然后再重新连接,就可以了。