使用scp复制文件/目录,在目标主机没有出现也无报错的解决

论坛 期权论坛 编程之家     
选择匿名的用户   2021-5-30 13:06   29   0

原因:虚拟机连了不同的wifi,主机名相同但是ip地址不一样。

解决:删除/root/.ssh/known_hosts下目标主机的密钥信息(目前的)

详解如下:

[root@node1 sbin]# scp /opt/hadoop-2.9.2/input/test.txt root@node2:/opt
test.txt 100% 12 12.1KB/s 00:00

没有报错,但是将主机名换成IP地址后就会发现问题

[root@node1 sbin]# scp /opt/hadoop-2.9.2/input/test.txt root@192.168.191.5:/opt
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ 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 RSA key sent by the remote host is
SHA256:lv1QRFf/1zC1aWxISaOIj6RCU4gw8TF3wJtSgYEW7C0.
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:7
RSA host key for 192.168.191.5 has changed and you have requested strict checking.
Host key verification failed.
lost connection

于是vi /root/.ssh/known_hosts,除本机以外的密钥信息都删除。

就可以正常使用scp了。

分享到 :
0 人收藏
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

积分:3875789
帖子:775174
精华:0
期权论坛 期权论坛
发布
内容

下载期权论坛手机APP