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

183 天前
 BeforeTooLate

服务器环境: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

427 次点击
所在节点    SSH
2 条回复
tool2d
183 天前
感觉像是 openssh 不支持客户端的老算法,可以手动加上 beyond compare3 支持的老算法,比如

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

之类的,再重启 sshd 就可以了。
BeforeTooLate
183 天前
@tool2d 万分感谢,真的是这个问题。

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/991522

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX