scp复制文件报错--It is also possible that a host key has just been changed.

场景:scp复制安装包到另外一台机器(1服务器复制到2上)
出现情况:今天使用scp复制安装包到另外一台机器,但是scp执行输入密码后就不动了,服务器也不进行复制操作,就一直卡在那。于是乎,我就从新做了2服务器的系统,然后在进行执行scp命令时报错信息如下:

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ 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:igzcN1Gh8smss4J+hYH/mBUO+3tiy9JxS20iSs1S89g.
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:1
ECDSA host key for 172.1.1.110 has changed and you have requested strict checking.
Host key verification failed.
lost connection

奇怪了,刚才还能到spc验证输入密码的步骤,为什么从做系统后,执行命令直接报错呢??

据提示的意思我翻译出了本地的known_hosts保存的主机hostkey记录改变了,导致之前已经记录了连接的服务器的IP及内容,当我们从左系统后,现2系统的内容变了,1中记录的是之前的内容。

所以,我们可以找到记录内容的位置,直接用命令把known_hosts记录删除掉!!

注意:rm -rf 命令一定要小心的执行!!!!!!!!!!!!!!!

rm -rf ~/.ssh/known_hosts  

然后在执行scp操作,可以了,收工!!!!

你可能感兴趣的:(日常小问题处理)