# 如有必要安装系统更新
sudo apt-get update
sudo apt-get upgrade
# 安装 fail2ban 服务
sudo apt-get install -y fail2ban
# 启动服务,并设置开机自动启动
sudo systemctl start fail2ban
sudo systemctl enable fail2ban
sudo vi /etc/fail2ban/jail.local
#写入内容
[sshd]
enabled = true
port = 50022
filter = sshd
logpath = /var/log/auth.log
maxretry = 3
# 修改配置文件后重启服务
sudo systemctl restart fail2ban
# 取消被限制 ip
sudo fail2ban-client set sshd unbanip 被限制 ip
正文完
发表至: *NIX相关
2020-09-05