1. 禁止某些IP
编辑文件 /etc/hosts.deny
,增加如下配置
sshd: 192.109.206.59
sshd: 143.110.188.151
2. 只允许指定的用户登录
文档:https://manpages.ubuntu.com/manpages/oracular/en/man5/sshd_config.5.html 匹配模式文档:https://manpages.ubuntu.com/manpages/oracular/en/man5/ssh_config.5.html#patterns
编辑文件 /etc/ssh/sshd_config
,增加如下规则,然后 reload
服务
AllowUsers fengbo
执行命令
systemctl reload ssh
3. 指定禁止登录的用户
文档:https://manpages.ubuntu.com/manpages/oracular/en/man5/sshd_config.5.html
关键字:DenyUsers
、DenyGroups