背景,通过ssh远程机器,第一次都会给出关于key的提示,输入:yes 可继续,此时远程机器的ssh key就保留本地,以后使用就能直接ssh。
如果远程机器重装系统了,我们再ssh,由于本地存储的是之前远端机器的ssh key,就造成无言验证通过。ssh被远端拒绝。
如下报错信息:
[root@localhost sharefile]# scp iomonitor-src.tar.gz root@ 10.49.32.150:/root
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ 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 ED25519 key sent by the remote host is
SHA256:ww0vBoLq47smkOJyRA7BNLZoCkN14qx1EAHrsQp/htc.
Please contact your system administrator.
Add correct host key in /root/.ssh/known_hosts to get rid of this message.
Offending ECDSA key in /root/.ssh/known_hosts:2
Host key for 10.49.32.150 has changed and you have requested strict checking.
Host key verification failed.
Connection closed
此时就需要清除之前的key,运行如下命令即可:
ssh-keygen -R 10.32.49.150