scp 提示报错 Password authentication is disabled to avoid man-in-the-middle attacks.

742 阅读1分钟

scp 指定端口传输文件遇到如下报错 scp -P port 1.txt remoteip:/dir @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @ 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:******************** 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:37 Password authentication is disabled to avoid man-in-the-middle attacks. Keyboard-interactive authentication is disabled to avoid man-in-the-middle attacks.

原因是密钥验证错误 解决方式: 编辑传输文件的主机的.ssh/known_hosts文件,找到与remoteip匹配的那一行,删掉,然后保存退出。 之后重新执行scp 命令,输入对应的ssh 密码,传输成功。