总结sshd服务常用参数

发布时间 2023-10-07 14:53:36作者: 小糊涂90

服务器端的配置文件: /etc/ssh/sshd_config

常用参数:
Port                                                 #端口号
ListenAddress ipLoginGraceTime 2m                    #宽限期
PermitRootLogin yes                                  #默认ubuntu不允许root远程ssh登录
StrictModes yes                                      #检查.ssh/文件的所有者,权限等
MaxAuthTries   6     
MaxSessions  10                                     #同一个连接最大会话
PubkeyAuthentication yes                             #基于key验证
PermitEmptyPasswords no                              #空密码连接
PasswordAuthentication yes                          #基于用户名和密码连接
GatewayPorts no
ClientAliveInterval 10                                #单位:秒
ClientAliveCountMax 3                                 #默认3
UseDNS yes                                            #提高速度可改为no
GSSAPIAuthentication yes                              #提高速度可改为no
MaxStartups                                           #未认证连接最大值,默认值10
Banner /path/file                                     #登录提示信息
#以下可以限制可登录用户的办法:
AllowUsers user1 user2 user3
DenyUsers
AllowGroups