• SSH连接 提示 ssh_exchange_identification: Connection closed by remote host


    今天想把服务器的安装包远程上传到另一台服务器上去 执行 scp命令 结果提示 ssh_exchange_identification: Connection closed by remote host

    执行命令 ssh -v root@10.0.0.83得出以下提示

    [root@localhost .ssh]# ssh -v root@10.0.0.98
    OpenSSH_7.4p1, OpenSSL 1.0.2k-fips 26 Jan 2017
    debug1: Reading configuration data /root/.ssh/config
    debug1: Reading configuration data /etc/ssh/ssh_config
    debug1: /etc/ssh/ssh_config line 58: Applying options for *
    debug1: Connecting to 10.0.0.51 [10.0.0.51] port 10580.
    debug1: Connection established.
    debug1: permanently_set_uid: 0/0
    debug1: identity file /root/.ssh/jenkins type 1
    debug1: key_load_public: No such file or directory
    debug1: identity file /root/.ssh/jenkins-cert type -1
    debug1: Enabling compatibility mode for protocol 2.0
    debug1: Local version string SSH-2.0-OpenSSH_7.4
    debug1: ssh_exchange_identification: HTTP/1.1 400 Bad Request

    经查看 是在.ssh目录下有一个config配置文件,配置文件内容如下

    [root@localhost .ssh]# cat /root/.ssh/config
    # 如果是以域名访问的则添加如下内容:
    # host xxx
    # HostName xxx.com
    # Port 3333
    # 如果以ip访问的,则添加如下内容:
    #Host neiwang
    #User git
    HostName "10.0.0.51"
    Port 10580
    IdentityFile ~/.ssh/jenkins

    这个配置文件的作用是可以指定不同的主机的连接的sshx信息

    解决方法:

    需要修改~/.ssh/config文件

    [root@localhost .ssh]# cat /root/.ssh/config
    # 如果是以域名访问的则添加如下内容:
    # host xxx
    # HostName xxx.com
    # Port 3333
    # 如果以ip访问的,则添加如下内容:
    #Host neiwang
    #User git

    ##指定各自的主机名,用于区分  
    Host git     
    HostName "10.0.0.51"
    Port 10580
    IdentityFile ~/.ssh/jenkins

    Host oth
    HostName 10.0.0.83
    Port 22
    User root

    扩展:

    ~/.ssh/config 配置文件的具体作用和用法 

    参考连接   https://www.cnblogs.com/xjshi/p/9146296.html

  • 相关阅读:
    MySQL在DOS界面对database和table增删改查
    js中获取css样式的两种方式
    js for循环中点击事件中无法获取每一个i值的问题
    ps快捷键
    一个简单的动态页面(我的第一个博客)
    Centos7 搭建 hadoop3.1.1 集群教程
    CSS rem与em的运用
    JS进制转换总结
    使用JS生成字符视频/画
    破解字体加密
  • 原文地址:https://www.cnblogs.com/pyng/p/13384117.html
Copyright © 2020-2023  润新知