# man > fail2ban-client(1)

---
type: CommandReference
command: fail2ban-client
mode: man
section: 1
source: man-pages
---

## Quick Reference

- `fail2ban-client status <jail>` — get status of a jail
- `fail2ban-client set <jail> unbanip <ip>` — unban an IP from a jail
- `fail2ban-client ping` — test server alive
- `fail2ban-client start` — start server and jails
- `fail2ban-client stop` — stop all jails and terminate server
- `fail2ban-client reload` — reload configuration without restart
- `fail2ban-client set <jail> banip <ip>` — manually ban an IP
- `fail2ban-client status` — get overall server status

## Name

configure and control the fail2ban server

## Synopsis

`fail2ban-client [OPTIONS] <COMMAND>`

## Options

- `-c, --conf <DIR>` — configuration directory
- `-s, --socket <PATH>` — socket path
- `-p, --pidfile <PATH>` — pidfile path
- `--pname <NAME>` — process name (default: `fail2ban-server`)
- `--loglevel <LEVEL>` — logging level
- `--logtarget <TARGET>` — logging target (file, stdout, stderr, syslog, sysout)
- `--syslogsocket auto|<FILE>` — syslog socket path
- `-d, --dp, --dump-pretty` — dump configuration in human-readable form
- `-t, --test` — test configuration
- `-i` — interactive mode
- `-v` — verbose
- `-q` — quiet
- `-x` — force start
- `-b` — start in background
- `-f` — start in foreground
- `--async` — start in async mode (internal only)
- `--timeout <SECONDS>` — timeout to wait for server (internal only)
- `--str2sec <STRING>` — convert time abbreviation to seconds
- `-h, --help` — display help
- `-V, --version` — print version

## Commands

### Basic

- `start` — starts the server and the jails
- `restart` — restarts the server
- `restart [--unban] [--if-exists] <JAIL>` — restarts the jail
- `reload [--restart] [--unban] [--all]` — reloads configuration without restarting server (optionally restart jails, unban IPs)
- `reload [--restart] [--unban] [--if-exists] <JAIL>` — reloads or restarts a specific jail
- `stop` — stops all jails and terminates the server
- `unban --all` — unbans all IP addresses (in all jails and database)
- `unban <IP> ... <IP>` — unbans given IPs (in all jails and database)
- `banned` — return jails with banned IPs as dictionary
- `banned <IP> ... <IP>` — return list of jails where given IPs are banned
- `status` — gets the current status of the server
- `status <JAIL> [FLAVOR]` — gets status of a jail (optional flavor or extended info)
- `ping` — tests if the server is alive
- `echo <STRING>` — returns and outputs a given string (internal)
- `help` — returns this output
- `version` — returns the server version

### Logging

- `set loglevel <LEVEL>` — sets logging level (CRITICAL, ERROR, WARNING, NOTICE, INFO, DEBUG, TRACEDEBUG, HEAVYDEBUG or numeric 50-5)
- `get loglevel` — gets the logging level
- `set logtarget <TARGET>` — sets logging target (STDOUT, STDERR, SYSLOG, or file)
- `get logtarget` — gets logging target
- `set syslogsocket auto|<SOCKET>` — sets syslog socket path
- `get syslogsocket` — gets syslog socket path
- `flushlogs` — flushes log file and reopens it (for log rotation)

### Database

- `set dbfile <FILE>` — set location of persistent datastore (`None` to disable)
- `get dbfile` — get database file location
- `set dbmaxmatches <INT>` — set max matches stored per ticket
- `get dbmaxmatches` — get max matches
- `set dbpurgeage <SECONDS>` — set max age for ban history
- `get dbpurgeage` — get max age

### Jail Control

- `add <JAIL> <BACKEND>` — creates a jail using a backend
- `start <JAIL>` — starts the jail
- `stop <JAIL>` — stops the jail (removed)
- `status <JAIL> [FLAVOR]` — gets status of the jail

### Jail Configuration

- `set <JAIL> idle on|off` — set idle state
- `set <JAIL> ignoreself true|false` — ignore own IP addresses
- `set <JAIL> addignoreip <IP>` — add IP to ignore list
- `set <JAIL> delignoreip <IP>` — remove IP from ignore list
- `set <JAIL> ignorecommand <VALUE>` — set ignorecommand
- `set <JAIL> ignorecache <VALUE>` — set ignorecache
- `set <JAIL> addlogpath <FILE> ['tail']` — add log file (optionally start at tail)
- `set <JAIL> dellogpath <FILE>` — remove log file
- `set <JAIL> logencoding <ENCODING>` — set log encoding
- `set <JAIL> addjournalmatch <MATCH>` — add journal filter match
- `set <JAIL> deljournalmatch <MATCH>` — remove journal filter match
- `set <JAIL> addfailregex <REGEX>` — add failure regex
- `set <JAIL> delfailregex <INDEX>` — remove failure regex at index
- `set <JAIL> addignoreregex <REGEX>` — add ignore regex
- `set <JAIL> delignoreregex <INDEX>` — remove ignore regex at index
- `set <JAIL> findtime <TIME>` — set lookback time for failures (seconds)
- `set <JAIL> bantime <TIME>` — set ban duration (seconds)
- `set <JAIL> datepattern <PATTERN>` — set date/time matching pattern
- `set <JAIL> usedns <VALUE>` — set usedns mode
- `set <JAIL> attempt <IP> [<failure> ...]` — manually notify about IP failure
- `set <JAIL> banip <IP> ... <IP>` — manually ban IPs
- `set <JAIL> unbanip [--report-absent] <IP> ... <IP>` — manually unban IPs
- `set <JAIL> maxretry <RETRY>` — set max failures before ban
- `set <JAIL> maxmatches <INT>` — set max matches per ticket in memory
- `set <JAIL> maxlines <LINES>` — set lines to buffer for regex search
- `set <JAIL> addaction <ACT> [<PYTHONFILE> <JSONKWARGS>]` — add an action (optionally Python-based)
- `set <JAIL> delaction <ACT>` — remove an action

### Command Action Configuration

- `set <JAIL> action <ACT> actionstart <CMD>` — set start command
- `set <JAIL> action <ACT> actionstop <CMD>` — set stop command
- `set <JAIL> action <ACT> actioncheck <CMD>` — set check command
- `set <JAIL> action <ACT> actionban <CMD>` — set ban command
- `set <JAIL> action <ACT> actionunban <CMD>` — set unban command
- `set <JAIL> action <ACT> timeout <TIMEOUT>` — set command timeout

### General Action Configuration

- `set <JAIL> action <ACT> <PROPERTY> <VALUE>` — set arbitrary property
- `set <JAIL> action <ACT> <METHOD> [<JSONKWARGS>]` — call a method

### Jail Information

- `get <JAIL> banned` — list banned IPs
- `get <JAIL> banned <IP> ...` — check if IP(s) are banned (returns 1/0)
- `get <JAIL> logpath` — get monitored log files
- `get <JAIL> logencoding` — get log encoding
- `get <JAIL> journalmatch` — get journal filter match
- `get <JAIL> ignoreself` — get ignore-self setting
- `get <JAIL> ignoreip` — get ignored IP list
- `get <JAIL> ignorecommand` — get ignorecommand
- `get <JAIL> failregex` — get failure regexes
- `get <JAIL> ignoreregex` — get ignore regexes
- `get <JAIL> findtime` — get findtime
- `get <JAIL> bantime` — get bantime
- `get <JAIL> datepattern` — get datepattern
- `get <JAIL> usedns` — get usedns
- `get <JAIL> banip [<SEP>|--with-time]` — get list of banned IPs (optionally with separator or times)
- `get <JAIL> maxretry` — get maxretry
- `get <JAIL> maxmatches` — get maxmatches
- `get <JAIL> maxlines` — get maxlines
- `get <JAIL> actions` — get list of actions

### Command Action Information

- `get <JAIL> action <ACT> actionstart` — get start command
- `get <JAIL> action <ACT> actionstop` — get stop command
- `get <JAIL> action <ACT> actioncheck` — get check command
- `get <JAIL> action <ACT> actionban` — get ban command
- `get <JAIL> action <ACT> actionunban` — get unban command
- `get <JAIL> action <ACT> timeout` — get command timeout

### General Action Information

- `get <JAIL> actionproperties <ACT>` — get list of properties
- `get <JAIL> actionmethods <ACT>` — get list of methods
- `get <JAIL> action <ACT> <PROPERTY>` — get property value

## Examples

shell
# Get status of a jail
fail2ban-client status sshd

# Unban an IP from a jail
fail2ban-client set sshd unbanip 192.168.1.100

# Test server is alive
fail2ban-client ping

# Manually ban an IP
fail2ban-client set sshd banip 10.0.0.5

# Reload configuration without restarting
fail2ban-client reload

# Start server and jails
fail2ban-client start
## See Also

- [fail2ban-server(1)](https://www.chedong.com/phpMan.php/man/fail2ban-server/1/markdown)
- [jail.conf(5)](https://www.chedong.com/phpMan.php/man/jail.conf/5/markdown)