V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
BeforeTooLate
V2EX  ›  SSH

请教个的 ssh 连接不上的问题, SSH2_MSG_KEXINIT sent 后马上关闭了

  •  
  •   BeforeTooLate · 167 天前 · 403 次点击
    这是一个创建于 167 天前的主题,其中的信息可能已经有所发展或是发生改变。

    服务器环境:Debian 12 ssh:OpenSSH_9.2p1 Debian-2+deb12u1, OpenSSL 3.0.11 19 Sep 2023

    1.本地终端如 Microsoft terminal 可以正常 ssh 连接
    2.同步对比软件 beyond compare 无法连接此服务器,但是可以正常连接其他老的 centos 服务器
    3.还是怀疑是我 beyond compare 版本太老了,下了最新的 beyond compare4 ,可以正常连接
    4.sshd 我开启了密码和密钥都可以认证,为啥 beyond compare3 还是不能连接,我就开启了日志 debug 模式,看看发生什么问题,发现在 SSH2_MSG_KEXINIT sent 后就直接关闭了,下面是日志,而本地客户端是看不到日志的,我查了下有说让我重新生成一下 ssh_host*,有的说 mtu 设置不对。试了都不行。
    2023-11-13T15:50:26.806667+08:00 xxxxx sshd[222683]: debug1: Forked child 222693.
    2023-11-13T15:50:26.807145+08:00 xxxxx sshd[222693]: debug1: Set /proc/self/oom_score_adj to 0
    2023-11-13T15:50:26.807247+08:00 xxxxx sshd[222693]: debug1: rexec start in 4 out 4 newsock 4 pipe 6 sock 7
    2023-11-13T15:50:26.816725+08:00 xxxxx sshd[222693]: debug1: inetd sockets after dupping: 4, 4
    2023-11-13T15:50:26.816825+08:00 xxxxx sshd[222693]: Connection from 1.1.1.1 port 62336 on 2.1.1.1 port 10011 rdomain ""
    2023-11-13T15:50:26.816891+08:00 xxxxx sshd[222693]: debug1: Local version string SSH-2.0-OpenSSH_9.2p1 Debian-2+deb12u1
    2023-11-13T15:50:26.824087+08:00 xxxxx sshd[222693]: debug1: Remote protocol version 2.0, remote software version Beyond
    2023-11-13T15:50:26.824194+08:00 xxxxx sshd[222693]: debug1: compat_banner: no match: Beyond
    2023-11-13T15:50:26.825178+08:00 xxxxx sshd[222693]: debug1: permanently_set_uid: 101/65534 [preauth]
    2023-11-13T15:50:26.825337+08:00 xxxxx sshd[222693]: debug1: list_hostkey_types: rsa-sha2-512,rsa-sha2-256,ecdsa-sha2-nistp256,ssh-ed25519 [preauth]
    2023-11-13T15:50:26.825398+08:00 xxxxx sshd[222693]: debug1: SSH2_MSG_KEXINIT sent [preauth]
    2023-11-13T15:50:26.833071+08:00 xxxxx sshd[222693]: Connection closed by 1.1.1.1 port 62336 [preauth]
    2023-11-13T15:50:26.833245+08:00 xxxxx sshd[222693]: debug1: do_cleanup [preauth]
    2023-11-13T15:50:26.833372+08:00 xxxxx sshd[222693]: debug1: monitor_read_log: child log fd closed
    2023-11-13T15:50:26.833414+08:00 xxxxx sshd[222693]: debug1: do_cleanup
    2023-11-13T15:50:26.833454+08:00 xxxxx sshd[222693]: debug1: Killing privsep child 222694
    2023-11-13T15:50:26.833487+08:00 xxxxx sshd[222693]: debug1: audit_event: unhandled event 12

    2 条回复    2023-11-13 16:41:08 +08:00
    tool2d
        1
    tool2d  
       167 天前   ❤️ 1
    感觉像是 openssh 不支持客户端的老算法,可以手动加上 beyond compare3 支持的老算法,比如

    echo "HostkeyAlgorithms ssh-dss,ssh-rsa" >> sshd_config
    echo "KexAlgorithms +diffie-hellman-group1-sha1" >> sshd_config

    之类的,再重启 sshd 就可以了。
    BeforeTooLate
        2
    BeforeTooLate  
    OP
       167 天前
    @tool2d 万分感谢,真的是这个问题。
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   1147 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 18:22 · PVG 02:22 · LAX 11:22 · JFK 14:22
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.