$linuxjunkies
>

fail2ban-client(1)

Interact with the Fail2ban server to manage jails, view status, and configure bans.

UbuntuDebianFedoraArch

Synopsis

fail2ban-client [OPTIONS] COMMAND [ARGUMENTS]

Description

fail2ban-client is a command-line interface to communicate with the Fail2ban daemon (fail2ban-server). It allows you to manage jails, set ban rules, unban IP addresses, view logs and statistics, and reload configurations without restarting the service.

Common operations include banning/unbanning hosts, enabling/disabling jails, and querying the status of active jails and their current ban lists. The client sends commands to the server via socket communication.

Common options

FlagWhat it does
-c CONFIG_DIRSpecify configuration directory (default: /etc/fail2ban)
-s SOCKET_PATHPath to fail2ban socket file
-p PORTPort for server communication
-v, --verboseIncrease verbosity of output
-d, --debugEnable debug output
-h, --helpShow help message and exit

Examples

Display overall status and list all active jails

fail2ban-client status

Show detailed status of the sshd jail including ban count and IP list

fail2ban-client status sshd

Manually ban an IP address in the sshd jail

fail2ban-client set sshd banip 192.168.1.100

Unban a previously banned IP address from the sshd jail

fail2ban-client set sshd unbanip 192.168.1.100

Ban an entire subnet in the sshd jail

fail2ban-client set sshd banip 10.0.0.0/8

Reload all jail configurations from disk

fail2ban-client reload

Enable the sshd jail

fail2ban-client set sshd enabled true

Disable the sshd jail without stopping the daemon

fail2ban-client set sshd enabled false

Related commands