FAIL2BAN-CLIENT(1)

๐Ÿ’… FAIL2BAN-CLIENT(1) ๐ŸŽ€

hii bestie!! you've landed on the FAIL2BAN-CLIENT(1) page โ€” it lives in the User Commands section of the manual, and honestly? iconic placement. this is the lil client that lets you talk to your fail2ban server: configure it, poke it, control it. no cap, it's giving main character energy already ๐Ÿฆ‹


โœจ NAME โœจ

fail2ban-client โ€” configure and control the server.

that's it. that's the whole job description. she configures, she controls, she slays ๐Ÿ’…

๐ŸŽ€ SYNOPSIS ๐ŸŽ€

fail2ban-client [OPTIONS] <COMMAND>

๐ŸŒธ DESCRIPTION ๐ŸŒธ

Fail2Ban v1.1.1 reads log file that contains password failure report and bans the corresponding IP addresses using firewall rules.

okay so in human words: she reads the log file that's full of password failure reports ๐Ÿ˜ญ and then bans the matching IP addresses using firewall rules, like a bouncer with a clipboard and zero chill. fr fr ๐Ÿ”ฅ


๐Ÿ‘‘ OPTIONS ๐Ÿ‘‘

grab a snack, there's a whole list ๐Ÿ“

  • -c, --conf <DIR> โ€” configuration directory. basically "bestie, the configs live HERE" ๐Ÿ—‚๏ธ
  • -s, --socket <FILE> โ€” socket path. the lil doorway she talks through ๐Ÿ”Œ
  • -p, --pidfile <FILE> โ€” pidfile path. where she leaves her pid receipt ๐Ÿงพ
  • --pname <NAME> โ€” name of the process (main thread) to identify instance, default is fail2ban-server. so you can be like "that one, yeah her" ๐Ÿ’…
  • --loglevel <LEVEL> โ€” logging level. how chatty she's feeling โœจ
  • --logtarget <TARGET> โ€” logging target, use file-name or stdout, stderr, syslog or sysout. pick her outfit, I mean her output ๐Ÿ’–
  • --syslogsocket โ€” auto|<FILE>. yes that's the whole thing.
  • -d โ€” dump configuration. for debugging ๐Ÿ›
  • --dp, --dump-pretty โ€” dump the configuration using more human readable representation. a pretty dump, we love a glow-up โœจ
  • -t, --test โ€” test configuration (can be also specified with start parameters). vibe check your config before she commits, love that for us ๐Ÿซถ
  • -i โ€” interactive mode. she wants engagement ๐Ÿ’ฌ
  • -v โ€” increase verbosity. more words, more tea โ˜•
  • -q โ€” decrease verbosity. shhh era ๐Ÿคซ
  • -x โ€” force execution of the server (remove socket file). she's not asking, she's telling ๐Ÿ’€
  • -b โ€” start server in background (default). lurking, respectfully ๐ŸŒ™
  • -f โ€” start server in foreground. front and center, main character style ๐Ÿ‘‘
  • --async โ€” start server in async mode. for internal usage only, don't read configuration โš ๏ธ like for real, this one's not for you
  • --timeout โ€” timeout to wait for the server. for internal usage only, don't read configuration โš ๏ธ same energy, hands off bestie
  • --str2sec <STRING> โ€” convert time abbreviation format to seconds. math but make it cute ๐Ÿงฎ
  • -h, --help โ€” display this help message. the classic "help me help you" ๐Ÿ™ˆ
  • -V, --version โ€” print the version (-V returns machine-readable short format). short and machine-readable, she's efficient like that ๐ŸŒˆ

okay that's the options handled โ€” but this page is not done with us yet, keep scrolling bestie ๐Ÿ’œ

โœจ COMMAND โœจ

okay bestie, this is the good part โ€” every single thing you can actually do with fail2ban-client. Buckle in, there's like a million of them and they're all iconic in their own way ๐Ÿ’…

๐ŸŒธ BASIC ๐ŸŒธ

  • start โ€” starts the server and the jails. the whole engine, up and running ๐Ÿš€
  • restart โ€” restarts the server. classic off-and-on-again energy.
  • restart [--unban] [--if-exists] <JAIL> โ€” restarts the jail <JAIL>. it's literally just an alias for reload --restart ... <JAIL>, no cap ๐Ÿซถ
  • reload [--restart] [--unban] [--all] โ€” reloads the config but doesn't restart the server itself. add --restart and the affected jails fully restart too, which can unban IP addresses (only if you also pass --unban, iykyk).
  • reload [--restart] [--unban] [--if-exists] <JAIL> โ€” reloads just <JAIL>, or restarts it if you threw in --restart.
  • stop โ€” stops all the jails and terminates the server. it's giving "closing time at the mall" ๐Ÿ˜ญ
  • unban --all โ€” unbans every single IP address, in all jails and the database. mass forgiveness era ๐Ÿ’–
  • unban <IP> ... <IP> โ€” unbans the <IP>(s) you name, across all jails and the database.
  • banned โ€” returns the jails that have banned IPs, as a dictionary.
  • banned <IP> ... <IP>] โ€” returns the list(s) of jails where the given IP(s) are banned.
  • status โ€” gets the current status of the server. the vibe check of the whole operation.
  • status --all [FLAVOR] โ€” gets the status of all the jails, with an optional output style [FLAVOR]. the flavors are: 'basic' (default), 'cymru', 'short', 'stats' โœจ
  • stat[istic]s โ€” gets the current statistics of all jails as a table. numbers girlies rise ๐Ÿ“
  • ping โ€” tests if the server is alive. are you there bestie?? ๐Ÿ‘€
  • echo โ€” for internal usage; returns back and outputs a given string.
  • version โ€” returns the server version. slay, what era are we in ๐Ÿ’…

๐Ÿ’œ LOGGING ๐Ÿ’œ

  • set loglevel <LEVEL> โ€” sets the logging level to <LEVEL>. the levels are: CRITICAL, ERROR, WARNING, NOTICE, INFO, DEBUG, TRACEDEBUG, HEAVYDEBUG, or the corresponding numeric value (50-5).
  • get loglevel โ€” gets the logging level.
  • set logtarget <TARGET> โ€” sets the logging target to <TARGET>. can be STDOUT, STDERR, SYSLOG, SYSTEMD-JOURNAL, or a file.
  • get logtarget โ€” gets the logging target.
  • set syslogsocket auto|<SOCKET> โ€” sets the syslog socket path to auto or <SOCKET>. heads up: this is only used if logtarget is SYSLOG ๐Ÿซถ
  • get syslogsocket โ€” gets the syslog socket path.
  • flushlogs โ€” flushes the logtarget if it's a file and reopens it. for log rotation, periodt.

๐Ÿฆ‹ DATABASE ๐Ÿฆ‹

  • set dbfile <FILE> โ€” sets the location of the fail2ban persistent datastore. set it to "None" to disable it entirely.
  • get dbfile โ€” gets the location of the fail2ban persistent datastore.
  • set dbmaxmatches <INT> โ€” sets the max number of matches stored in the database per ticket.
  • get dbmaxmatches โ€” gets the max number of matches stored in the database per ticket.
  • set dbpurgeage <SECONDS> โ€” sets the max age, in <SECONDS>, that the history of bans will be kept.
  • get dbpurgeage โ€” gets the max age in seconds that the history of bans will be kept.

๐Ÿ‘‘ JAIL CONTROL ๐Ÿ‘‘

  • add <JAIL> <BACKEND> โ€” creates <JAIL> using <BACKEND>.
  • start <JAIL> โ€” starts the jail <JAIL>.
  • stop <JAIL> โ€” stops the jail <JAIL>. ngl, the jail is removed.
  • status <JAIL> [FLAVOR] โ€” gets the current status of <JAIL>, with an optional output style [FLAVOR]. flavors: 'basic' (default), 'cymru', 'short', 'stats'.

๐ŸŽ€ JAIL CONFIGURATION ๐ŸŽ€

  • set <JAIL> idle on|off โ€” sets the idle state of <JAIL>.
  • set <JAIL> ignoreself true|false โ€” allows the ignoring of your own IP addresses.
  • set <JAIL> addignoreip <IP> โ€” adds <IP> to the ignore list of <JAIL>.
  • set <JAIL> delignoreip <IP> โ€” removes <IP> from the ignore list of <JAIL>.
  • set <JAIL> ignorecommand <VALUE> โ€” sets ignorecommand of <JAIL>.
  • set <JAIL> ignorecache <VALUE> โ€” sets ignorecache of <JAIL>.
  • set <JAIL> addlogpath <FILE> ['tail'] โ€” adds <FILE> to the monitoring list of <JAIL>, optionally starting at the 'tail' of the file (default is 'head').
  • set <JAIL> dellogpath <FILE> โ€” removes <FILE> from the monitoring list of <JAIL>.
  • set <JAIL> logencoding <ENCODING> โ€” sets the <ENCODING> of the log files for <JAIL>.
  • set <JAIL> addjournalmatch <MATCH> โ€” adds <MATCH> to the journal filter of <JAIL>.
  • set <JAIL> deljournalmatch <MATCH> โ€” removes <MATCH> from the journal filter of <JAIL>.
  • set <JAIL> addfailregex <REGEX> โ€” adds the regular expression <REGEX>, which must match failures for <JAIL>.
  • set <JAIL> delfailregex <INDEX> โ€” removes the regular expression at <INDEX> for failregex.
  • set <JAIL> addignoreregex <REGEX> โ€” adds the regular expression <REGEX>, which should match patterns to exclude for <JAIL>.
  • set <JAIL> delignoreregex <INDEX> โ€” removes the regular expression at <INDEX> for ignoreregex.
  • set <JAIL> findtime <TIME> โ€” sets the number of seconds <TIME> for which the filter will look back for <JAIL>.
  • set <JAIL> bantime <TIME> โ€” sets the number of seconds <TIME> a host will be banned for <JAIL>.
  • set <JAIL> datepattern <PATTERN> โ€” sets the <PATTERN> used to match date/times for <JAIL>.
  • set <JAIL> usedns <VALUE> โ€” sets the usedns mode for <JAIL>.
  • set <JAIL> attempt <IP> [<failure1> ... <failureN>] โ€” manually notify about <IP> failure.
  • set <JAIL> banip <IP> ... <IP> โ€” manually Ban <IP> for <JAIL>. you're the bouncer now ๐Ÿ’…
  • set <JAIL> unbanip [--report-absent] <IP> ... <IP> โ€” manually Unban <IP> in <JAIL>.
  • set <JAIL> maxretry <RETRY> โ€” sets the number of failures <RETRY> before banning the host for <JAIL>.
  • set <JAIL> maxmatches <INT> โ€” sets the max number of matches stored in memory per ticket in <JAIL>.
  • set <JAIL> maxlines <LINES> โ€” sets the number of <LINES> to buffer for regex search for <JAIL>.
  • set <JAIL> addaction <ACT>[ <PYTHONFILE> <JSONKWARGS>] โ€” adds a new action named <ACT> for <JAIL>. optionally, for a Python-based action, you can specify a <PYTHONFILE> and <JSONKWARGS>; otherwise it'll be a Command Action.
  • set <JAIL> delaction <ACT> โ€” removes the action <ACT> from <JAIL>.

๐ŸŒˆ COMMAND ACTION CONFIGURATION ๐ŸŒˆ

  • set <JAIL> action <ACT> actionstart <CMD> โ€” sets the start command <CMD> of the action <ACT> for <JAIL>.
  • set <JAIL> action <ACT> actionstop <CMD> โ€” sets the stop command <CMD> of the action <ACT> for <JAIL>.
  • set <JAIL> action <ACT> actioncheck <CMD> โ€” sets the check command <CMD> of the action <ACT> for <JAIL>.
  • set <JAIL> action <ACT> actionban <CMD> โ€” sets the ban command <CMD> of the action <ACT> for <JAIL>.
  • set <JAIL> action <ACT> actionunban <CMD> โ€” sets the unban command <CMD> of the action <ACT> for <JAIL>.
  • set <JAIL> action <ACT> timeout <TIMEOUT> โ€” sets <TIMEOUT> as the command timeout in seconds for the action <ACT> for <JAIL>.

๐Ÿงš GENERAL ACTION CONFIGURATION ๐Ÿงš

  • set <JAIL> action <ACT> <PROPERTY> <VALUE> โ€” sets the <VALUE> of <PROPERTY> for the action <ACT> for <JAIL>.
  • set <JAIL> action <ACT> <METHOD>[ <JSONKWARGS>] โ€” calls the <METHOD> with <JSONKWARGS> for the action <ACT> for <JAIL>.

๐Ÿฆ‹ JAIL INFORMATION ๐Ÿฆ‹

  • get <JAIL> banned โ€” returns the banned IPs of <JAIL>.
  • get <JAIL> banned <IP> ... <IP>] โ€” returns 1 if the IP is banned in <JAIL>, otherwise 0; or a list of 1/0 for multiple IPs.
  • get <JAIL> logpath โ€” gets the list of the monitored files for <JAIL>.
  • get <JAIL> logencoding โ€” gets the encoding of the log files for <JAIL>.
  • get <JAIL> journalmatch โ€” gets the journal filter match for <JAIL>.
  • get <JAIL> ignoreself โ€” gets the current value of the ignoring of your own IP addresses.
  • get <JAIL> ignoreip โ€” gets the list of ignored IP addresses for <JAIL>.
  • get <JAIL> ignorecommand โ€” gets ignorecommand of <JAIL>.
  • get <JAIL> failregex โ€” gets the list of regular expressions which match the failures for <JAIL>.
  • get <JAIL> ignoreregex โ€” gets the list of regular expressions which match patterns to ignore for <JAIL>.
  • get <JAIL> findtime โ€” gets the time for which the filter will look back for failures for <JAIL>.
  • get <JAIL> bantime โ€” gets the time a host is banned for <JAIL>.
  • get <JAIL> datepattern โ€” gets the pattern used to match date/times for <JAIL>.
  • get <JAIL> usedns โ€” gets the usedns setting for <JAIL>.
  • get <JAIL> banip [<SEP>|--with-time] โ€” gets the list of banned IP addresses for <JAIL>. optionally you can pass the separator character ('<SEP>', default is space) or the option '--with-time' (which prints the times of ban). the IPs are ordered by end of ban โœจ
  • get <JAIL> maxretry โ€” gets the number of failures allowed for <JAIL>.
  • get <JAIL> maxmatches โ€” gets the max number of matches stored in memory per ticket in <JAIL>.
  • get <JAIL> maxlines โ€” gets the number of lines to buffer for <JAIL>.
  • get <JAIL> actions โ€” gets a list of actions for <JAIL>.

๐Ÿ’œ COMMAND ACTION INFORMATION ๐Ÿ’œ

  • get <JAIL> action <ACT> actionstart โ€” gets the start command for the action <ACT> for <JAIL>.
  • get <JAIL> action <ACT> actionstop โ€” gets the stop command for the action <ACT> for <JAIL>.
  • get <JAIL> action <ACT> actioncheck โ€” gets the check command for the action <ACT> for <JAIL>.
  • get <JAIL> action <ACT> actionban โ€” gets the ban command for the action <ACT> for <JAIL>.
  • get <JAIL> action <ACT> actionunban โ€” gets the unban command for the action <ACT> for <JAIL>.
  • get <JAIL> action <ACT> timeout โ€” gets the command timeout in seconds for the action <ACT> for <JAIL>.

๐Ÿ“ GENERAL ACTION INFORMATION ๐Ÿ“

  • get <JAIL> actionproperties <ACT> โ€” gets a list of properties for the action <ACT> for <JAIL>.
  • get <JAIL> actionmethods <ACT> โ€” gets a list of methods for the action <ACT> for <JAIL>.
  • get <JAIL> action <ACT> <PROPERTY> โ€” gets the value of <PROPERTY> for the action <ACT> for <JAIL>.

๐Ÿ“‚ FILES ๐Ÿ“‚

  • /etc/fail2ban/*

that's the whole config neighborhood, bestie ๐Ÿก


๐Ÿ› REPORTING BUGS ๐Ÿ›

found a bug? don't gatekeep it โ€” report it to https://github.com/fail2ban/fail2ban/issues ๐Ÿซถ


๐ŸŒธ SEE ALSO ๐ŸŒธ


okay that's the whole thing, you're officially a fail2ban-client expert now, no cap ๐Ÿ‘‘ this gorgeous specimen of a manual page came from Fail2Ban v1.1.1, dated August 2026, and it's the FAIL2BAN-CLIENT(1) page โ€” go forth and ban responsibly, mwah ๐Ÿ’‹๐Ÿ’–โœจ

๐Ÿ“ฆ where this page comes from