ssh登陆概率性失败,
- 作者: 多梦笔记
- 时间: 2026年02月17日 00:00
0
分享
ssh登陆概率性失败,报错:kex_exchange_identificationkex_exchange_identification: Connection closed by remote host
通过内网主机或者远程主机ssh登陆概率性失败,最高登陆失败率达到80%左右。
内网win主机登陆表现为登陆失败,需要反复登陆多次,因为这台主机是我内网的集中管控服务器,不能轻易的重装或者调整,整个大内网都靠它去监控和维护。期间尝试过更改各种配置,包括某乎帖子中的各种操作。 无效!!!
我只能默默的忍受~
我的解决办法是在xshell建立快捷方式,然后疯狂点击快捷方式登陆,好几个月的运维工作都是这么DT的过的,直到我,,,,再也不想忍受了。
尝试从别的服务器ssh登陆,报错信息如下:
[root@localhost ]# ssh -vvv tset@192.168.XX.XX
OpenSSH_8.1p1, OpenSSL 1.0.2p 14 Aug 2018
debug1: Reading configuration data /etc/ssh/ssh_config
debug2: resolve_canonicalize: hostname 192.168.XX.XX is address
debug2: ssh_connect_direct
debug1: Connecting to 192.168.XX.XX [192.168.XX.XX] port 22.
debug1: Connection established.
debug1: identity file /root/.ssh/id_rsa type -1
debug1: identity file /root/.ssh/id_rsa-cert type -1
debug1: identity file /root/.ssh/id_dsa type -1
debug1: identity file /root/.ssh/id_dsa-cert type -1
debug1: identity file /root/.ssh/id_ecdsa type -1
debug1: identity file /root/.ssh/id_ecdsa-cert type -1
debug1: identity file /root/.ssh/id_ed25519 type -1
debug1: identity file /root/.ssh/id_ed25519-cert type -1
debug1: identity file /root/.ssh/id_xmss type -1
debug1: identity file /root/.ssh/id_xmss-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_8.1
kex_exchange_identification: Connection closed by remote host
百度报错信息无果,全是这个报错信息ssh_exchange_identification: Connection closed by remote host,根本没有我要找的KEX,无奈,只能尝试更改并行登陆参数和最大连接数。
MaxSessions:最大允许链接数,默认10.
MaxStartups:最大允许保持多少个未认证链接(未输入登录密码),默认值是10.
#MaxStartups 10:30:100 原配置指定SSH守护进程未经身份验证的并发连接的最大数量,默认值是 10:30:100。10:30:100表示的意思是,从第10个连接开始,以30%的概率(递增)拒绝新的连接,指导连接数达到100。
sshd的MaxStartups配置限制了可以并行认证的客户端数量为10,别问我为啥知道,自己登陆上去看cat /etc/ssh/sshd_config |grep MaxStartups 就知道了。
可查看ssh连接数netstat -nat | grep -i ‘22’ | wc -l 或者lsof -i:22 |wc -l
我将MaxSessions 改成 2000MaxStartups 也改成2000
然后重启sshd服务世界终于太平无事了。原来都是并发连接惹的祸。
- 上一篇: MacOS AssetCache 占用网速原因以及解决办法
- 下一篇: PHP添加Redis模块及连接
相关文章
-
MacOS AssetCache 占用网速原因以及解决办法
MacOS AssetCache 占用网速原因以及解决办法
- 站长
- 2026年02月17日
-
使用 COS 静态网站功能搭建前端单页应用
使用 COS 静态网站功能搭建前端单页应用
- 站长
- 2026年02月17日
-
启用了被称为 HTTP 严格传输安全(HSTS)的安全策略
启用了被称为 HTTP 严格传输安全(HSTS)的安全策略
- 站长
- 2026年02月16日
-
PHP添加Redis模块及连接
PHP添加Redis模块及连接
- 站长
- 2026年02月17日
-
php如何将普通数据转化为json数据
php如何将普通数据转化为json数据
- 站长
- 2026年02月17日
-
报错:请验证实例名称是否正确并且 SQL Server 已配置为允许远程连接
报错:请验证实例名称是否正确并且 SQL Server 已配置为允许远程连接
- 站长
- 2026年02月17日
