原因:虛擬機連了不同的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 [email protected]:/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了。