scp命令报错(IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!)
使用scp命令移动某一服务器的文件到另外的服务器时报出一下错误:
[root@bogon vm_sys1]# scp project.tar.gz root@172.31.0.90:/webdata/ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @ 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 the RSA host key has just been changed. The fingerprint for the RSA key sent by the remote host is 00:76:4d:f0:26:a3:05:1e:d6:fd:e7:56:32:32:77:41. Please contact your system administrator. Add correct host key in /root/.ssh/known_hosts to get rid of this message. Offending key in /root/.ssh/known_hosts:8 RSA host key for 172.31.0.90 has changed and you have requested strict checking. Host key verification failed. lost connection
仔细分析了一下大概是因为172.31.0.90的主机密钥改了,而本机使用的还是原来的公钥与其匹配,因此会出现错误。有人问不是我们使用密码么,嗯,原因是这样,一旦使用本机ssh连接过目标机,则会在~/.ssh/know_hosts文件下生成目标机的公钥,以便下次可以直接使用。所以,我们可以把该文件下172.31.0.90对应的公钥删除掉
vi ~/.ssh/know_hosts
删除掉172.31.0.90那一行。