• ssh-copy-id 遇到ERROR: Host key verification failed.


    由于在/home/user/.ssh/known_hosts中记录的目标机器信息与当前不符(多为重用了IP地址造成),执行Ssh-copy-id时有下面的报错:

    [bmsc_ci@jenkins-slave2 ~]$ ssh-copy-id -i /home/user/.ssh/id_rsa.pub root@192.168.125.112
    /usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed

    /usr/bin/ssh-copy-id: ERROR: @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
    ERROR: @ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @
    ERROR: @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
    ERROR: IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
    ERROR: Someone could be eavesdropping on you right now (man-in-the-middle attack)!
    ERROR: It is also possible that a host key has just been changed.
    ERROR: The fingerprint for the RSA key sent by the remote host is
    ERROR: 39:b0:5f:e1:01:77:fe:5b:b9:ff:2d:2b:a0:fd:f5:3a.
    ERROR: Please contact your system administrator.
    ERROR: Add correct host key in /home/user/.ssh/known_hosts to get rid of this message.
    ERROR: Offending RSA key in /home/user/.ssh/known_hosts:185
    ERROR: RSA host key for 192.168.125.112 has changed and you have requested strict checking.
    ERROR: Host key verification failed.

    解决方法:

    ssh-copy-id  -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null  -i /home/user/.ssh/id_rsa.pub root@192.168.125.112

    同样地,此情况时ssh, scp 也会报错,解决办法是:

    ssh -q -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null root@192.168.125.112

    scp -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -r /var/tmp/performance/moo.dat root@192.168.125.110:/var/tmp/

  • 相关阅读:
    spring boot 启动后执行初始化方法
    Linux CentOS 7 下 JDK 安装与配置
    Linux rpm 命令参数使用详解[介绍和应用]
    异常处理: 重载Throwable.fillInStackTrace方法已提高Java性能
    dubbo 配置属性
    centos7 操作防火墙
    springBoot 打包 dubbo jar包
    直播中聊天场景的用例分享
    解决在安装Fiddler4.6版本后,在手机上安装证书出现的问题解决方法
    系统调优方案思路分享
  • 原文地址:https://www.cnblogs.com/tlmn2008/p/5306632.html
Copyright © 2020-2023  润新知