总结sshd服务常用参数。

sshd:openssh服务器守护进程。

服务器端:sshd

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

常用参数:

Port  #生产建议修改
ListenAddress ip
LoginGraceTime 2m
PermitRootLogin yes  #默认ubuntu不允许root远程ssh登录
StrictModes yes  #检查.ssh/文件的所有者,权限等
MaxAuthTries 6  #pecifies 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 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 user1 user2 user3
AllowGroups g1 g2
DenyGroups g1 g2

ssh服务的最佳实践:
(1)建议使用非默认端口
(2)禁止使用protocol version 1
(3)限制可登录用户
(4)设定空闲会话超时时长
(5)利用防火墙设置ssh访问策略
(6)仅监听特定的IP地址
(7)基于口令认证时,使用强密码策略,比如:tr -dc A-Za-z0-9_ < /dev/urandom | head -c 12|
xargs
(8)使用基于密钥的认证
(9)禁止使用空密码
(10)禁止root用户直接登录
(11)限制ssh的访问频度和并发在线数
(12)经常分析日志

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

一直在努力学习的菜鸟

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值