How to Protect SSH with Fail2Ban

Fail2ban is a service that can be run on your server to dynamically block clients that repeatedly fail to authenticate correctly with your services . This can help mitigate the affect of brute force attacks and illegitimate users of your services. In this guide, we’ll demonstrate how to install and configure fail2ban to protect SSH on an Ubuntu 22.04 server.

CentOS

7

How To Protect SSH With Fail2Ban on CentOS 7

Learn How To Protect SSH With Fail2Ban on CentOS 7
6

How To Protect SSH with fail2ban on CentOS 6

Learn How To Protect SSH with fail2ban on CentOS 6

Debian

11

How To Protect SSH with Fail2Ban on Debian 11

Learn How To Protect SSH with Fail2Ban on Debian 11
7

How To Protect SSH with fail2ban on Debian 7

Learn How To Protect SSH with fail2ban on Debian 7

Rocky Linux

9

How To Protect SSH with Fail2Ban on Rocky Linux 9

Learn How To Protect SSH with Fail2Ban on Rocky Linux 9
8

How To Protect SSH with Fail2Ban on Rocky Linux 8

Learn How To Protect SSH with Fail2Ban on Rocky Linux 8

Ubuntu

22.04

How To Protect SSH with Fail2Ban on Ubuntu 22.04

Learn How To Protect SSH with Fail2Ban on Ubuntu 22.04
20.04

How To Protect SSH with Fail2Ban on Ubuntu 20.04

Learn How To Protect SSH with Fail2Ban on Ubuntu 20.04
14.04

How To Protect SSH with Fail2Ban on Ubuntu 14.04

Learn How To Protect SSH with Fail2Ban on Ubuntu 14.04
12.04

How To Protect SSH with fail2ban on Ubuntu 12.04

Learn How To Protect SSH with fail2ban on Ubuntu 12.04

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.