80后的细娃儿

Ubuntu16.04/18.04安装Fail2ban步骤

#如有必要安装系统更新
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

点赞

发表评论