sshd连接数配置

sshd连接数配置 /etc/ssh/sshd_config,减少由于连接数不足导致的超时timeout的情况。

MaxAuthTries

指定每个连接最大允许的认证次数。默认值是 6
如果一个SSH会话认证失败的次数超过MaxAuthTries的一半,则记录额外的错误日志
MaxAuthTries Specifies the maximum number of authentication attempts permitted per connection. Once the number of failures reaches half this value, additional failures are logged. The default is 6.

MaxSessions

每个网络连接允许的最大打开会话数

MaxSessions Specifies the maximum number of open sessions permitted per network connection. The default is 10.

MaxStartups

指定当前最多有多少个未完成认证的并发连接,超过则可能拒绝连接。
由三个值组成 “start:rate:full” (e.g. “10:30:60”)
这个是限制处于联机页面的连接数,默认值10。联机页面就是当你登录ssh时,还没输入密码的页面。
三元组形式
10:30:60
10:当连接数达到10时就开始拒绝连接,不过不是全部拒绝,我们继续往下看
30:当连接数到达10时,之后的连接有30的概率被拒绝掉
60:当连接数达到60时,之后的连接就全部拒绝了
一个数字的形式
我们可以直接 写个60,这样言简意赅,连接数达到60之前敞开玩,达到60后就不能玩了。

Specifies the maximum number of concurrent unauthenticated connections to the SSH daemon. Additional connections will be dropped until authentication succeeds or the
LoginGraceTime expires for a connection. The default is 10:30:100.

Alternatively, random early drop can be enabled by specifying the three colon separated values “start:rate:full” (e.g. “10:30:60”). sshd(8) will refuse connection attempts with a
probability of “rate/100” (30%) if there are currently “start” (10) unauthenticated connections. The probability increases linearly and all connection attempts are refused if the
number of unauthenticated connections reaches “full” (60).

总结

MaxStartups的几个值都调大,例如300:30:1000, 或者干脆直接只写1000好了

sshd连接数配置》有1条评论

发表评论

您的电子邮箱地址不会被公开。 必填项已用*标注