Skip to content

Instantly share code, notes, and snippets.

@atomtigerzoo
Last active February 4, 2018 15:34
Show Gist options
  • Save atomtigerzoo/5dcecde83e4d41b82566cca1e694dc21 to your computer and use it in GitHub Desktop.
Save atomtigerzoo/5dcecde83e4d41b82566cca1e694dc21 to your computer and use it in GitHub Desktop.
Block IP with fail2ban from command line

A quick block for clients that bother you somehow or do malicious stuff.

List your jails

 sudo fail2ban-client status

Choose the jail you want to block the IP from/add it to.

Block the IP

 sudo fail2ban-client -vvv set [JAILNAME] banip [IP]

Replace [JAILNAME] with a jail from first list and [IP] with the IP address to be blocked.

The block is not permanent and will be removed on reboot/restart of fail2ban.

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