fail2ban-client(1)
Interact with the Fail2ban server to manage jails, view status, and configure bans.
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
| Flag | What it does |
|---|---|
-c CONFIG_DIR | Specify configuration directory (default: /etc/fail2ban) |
-s SOCKET_PATH | Path to fail2ban socket file |
-p PORT | Port for server communication |
-v, --verbose | Increase verbosity of output |
-d, --debug | Enable debug output |
-h, --help | Show help message and exit |
Examples
Display overall status and list all active jails
fail2ban-client statusShow detailed status of the sshd jail including ban count and IP list
fail2ban-client status sshdManually ban an IP address in the sshd jail
fail2ban-client set sshd banip 192.168.1.100Unban a previously banned IP address from the sshd jail
fail2ban-client set sshd unbanip 192.168.1.100Ban an entire subnet in the sshd jail
fail2ban-client set sshd banip 10.0.0.0/8Reload all jail configurations from disk
fail2ban-client reloadEnable the sshd jail
fail2ban-client set sshd enabled trueDisable the sshd jail without stopping the daemon
fail2ban-client set sshd enabled false