Skip to content

Instantly share code, notes, and snippets.

@johnstanfield
Created May 13, 2021 17:59
Show Gist options
  • Save johnstanfield/213ab7d58d585f3adce25cd16d053676 to your computer and use it in GitHub Desktop.
Save johnstanfield/213ab7d58d585f3adce25cd16d053676 to your computer and use it in GitHub Desktop.
install fail2ban on amazon linux 2
# run as root or sudo everything below
# install epel
amazon-linux-extras install epel -y
# install fail2ban
yum -y install fail2ban
# configure fail2ban (just adding enabled=true in the sshd section)
cp /etc/fail2ban/jail.conf /etc/fail2ban/jail.local
sed -i "s/^\[sshd\]/[sshd]\nenabled=true/" /etc/fail2ban/jail.local
# profit
systemctl restart fail2ban
@kerren
Copy link

kerren commented Dec 4, 2022

Thanks for this!

It may be good to add

systemctl enable fail2ban

To ensure it starts up on reboot 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment