Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more

Configure Fail2ban without editing its packaged configuration: create /etc/fail2ban/jail.local, set safe defaults in [DEFAULT], add your trusted administration addresses to ignoreip, enable the [sshd] jail, then reload and verify it. The example below uses a one-hour default ban, a ten-minute observation window and five failures as illustrative values; adjust them to your access pattern and risk tolerance.

What Fail2ban does on a VPS

Fail2ban watches authentication logs for patterns that match a jail filter. When an address exceeds that jail’s failure threshold during its time window, Fail2ban invokes the jail’s configured action to block the address. For an internet-facing VPS, the SSH jail is the usual starting point because repeated password guesses are visible in the SSH authentication log.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Fail2ban is configuration-driven. A jail has a filter, a log source or backend, a failure counter and a ban action. It does not make a weak password strong, replace key-based authentication or remove the need for updates and a correctly configured firewall. Its role here is to reduce repeated automated attempts and give you a controllable response to them.

Why jail.local is the right file

Leave the distributed .conf files unchanged. Package upgrades can replace those files, while your site-specific settings in .local files are intended to persist. The effective configuration is read in this order:

#1 Best Overall
Sale
Compressed Air Duster,130000RPM Super Power Cordless Air Duster,Rechargeable Brushless Blower,3 Gear Adjustable Blower with LED Light,Dust Remover for Computer/House/Outdoor/Car
  • Powerful Turbo Fan:CAGIWIRU Electric Air Duster have reached speed up to 130000RPM,Can efficient remove dust and debris.With LED light and Three Adjustable Speed to meet with different cleaning tasks.
  • With Attached USB C Fasting Charging cable.Charing 3 hours,Enjoy up to 240 minutes of use on the lowest setting, For third speed can use for 25mins.with four charging options to meet with your needs.
  • Wide Application:Upgraded attached 5 different nozzles,making it suitable for a variety of scenes, such as car,pet, pc, keyboards, and other electronic devices. It also serves for office and home clean duster.
  • Handy Design & Portable:Cordless air duster electric nozzle is Light weight and small size, design and comfortable to hold and space saving, convenient to carry around. You can put it in your room or inside the car without taking up space.
  • Warranty & Support: Our Electric air duster comes with 5 years warranty and 24/7 customer service. During this period, if you have any questions,pls kindly feel free to contact us.
  1. jail.conf
  2. jail.d/*.conf
  3. jail.local
  4. jail.d/*.local

Later files override values loaded earlier. This ordering lets a small local override change a default without copying the entire vendor file. Every jail is disabled by default, so merely having an [sshd] section does not activate protection; it must contain enabled = true.

Prerequisites and lockout precautions

  • Confirm that Fail2ban is installed and that the service starts on your distribution.
  • Keep an existing SSH session open while changing the configuration. Test a second session before closing the first.
  • Collect every address or subnet from which you administer the VPS, including a VPN egress address if you use one.
  • Put those trusted addresses in ignoreip before enabling a strict SSH jail. Otherwise your own failed login tests can trigger a ban.
  • Check the installed version and read its local jail.conf(5) manual. Defaults and optional features differ between Fail2ban releases and distributions.

How to configure Fail2ban: create the override

  1. Create or open the local override as root:

    sudo editor /etc/fail2ban/jail.local

    If the file does not exist, your editor will create it. Do not modify /etc/fail2ban/jail.conf.

    Free tools Windows power users keep installed

    One-click scans. No signup required.

    Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  2. Add shared defaults. This example uses the loopback addresses and the documentation-only IPv4 address 203.0.113.10; replace that example with your real management address or subnet before saving:

    [DEFAULT]
    ignoreip = 127.0.0.1/8 ::1 203.0.113.10
    bantime = 3600
    findtime = 600
    maxretry = 5

    These numbers are examples drawn from a published setup guide, not universal recommendations. bantime = 3600 is one hour, findtime = 600 is ten minutes and maxretry = 5 permits five matching failures in that window before the jail bans the address.

  3. Enable SSH protection with an explicit jail section:

    Rank #2
    EVEO® Screen Cleaner Spray Kit (Streak-Free) TV Screen Cleaner for Smart TV, Lcd, LEd, Oled | Computer Screen Cleaner Spray and Wipe Microfiber Cloth - TV, Monitor, Laptop, iPad, Car - 6.7oz 1 Pack
    • Screen Cleaner is Your Screen’s New Bestfriend! - EVEO is proud to present a screen cleaner that’s perfectly suited for your TV. Meet your new screen cleaner, computer screen cleaner, laptop cleaner, iPad cleaner, Macbook,tv cleaner or any other electronic device. Our screen cleaner spray and wipe along with the included plush microfiber cloth, easily removes dust, fingerprints & other smudges on the screen’s surface. Clean effectively for a streak-free screen
    • Gentle on your Screens - Our screen cleaner spray and wipes is compatible to be used even for the most sensitive LCD, LED, CRT, and OLED screens in proper use. Be at ease knowing that this product is compatible with all the major brands: LG, SONY, Samsung, Sharp, iPad, iPhone, Android screens, Kindle, PC monitors - we’ve got you covered! Can be used as LCD screen cleaner, tv cleaner, smart tv screen cleaner, and more
    • Premium Super Soft Plush Microfiber Cloth - Included in this efficient screen cleaning kit. This screen cleaner spray and wipe has our signature plush microfiber cloth specially designed to comply with screens and monitors and leave them streak-free. Has been shown to effectively absorbs stubborn stains, zero streaks, and no fiber shedding. Always use this together with our screen cleaner for the best results
    • Easy-to-Use Screen Cleaner Kit + microfiber cleaning cloth - The EVEO Screen Cleaning Kit will easily be your new favorite tool when it comes to taking care of the things you love most, quick and easy solution for a streak-free screen. Simply screw on the sprayer gun on the screen cleaner bottle. Spray the cleaning liquid onto the microfiber cloth, then wipe the screen until desired cleanliness & shine is achieved.
    • Quality Screen Care Kit Worth Purchasing - Enjoy a convenient Screen Cleaner anytime, anywhere you need it. Your satisfaction is our top priority. We stand behind the quality of our products and that’s why, you shouldn’t be worrying at all. We manufacture the Best Screen Cleaner. and can be used for laptop cleaning kit, laptop screen cleaner, tv screen cleaner for smart tv. MacBook screen cleaner, monitor cleaner or screen cleaner spray for electronic devices with microfiber cleaning cloth
    [sshd]
    enabled = true
    port = ssh
    filter = sshd
    maxretry = 3
    bantime = 86400

    Here the SSH jail overrides the shared retry and ban values: three failures trigger a 24-hour ban. Another documented example uses a five-minute (findtime = 300) failure window in the SSH section. The tutorials disagree on exact numbers, so select values that match your normal login behavior and recovery capabilities.

    Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  4. Save the file and check its permissions. It should be readable by the Fail2ban service and writable only by administrators; the exact owner and mode can vary by distribution.

fail2ban jail.local example

The following complete example combines the shared defaults and SSH jail in one file. The address shown is reserved for documentation; use your actual fixed address, VPN subnet or other trusted source in production.

[DEFAULT]
ignoreip = 127.0.0.1/8 ::1 203.0.113.10
bantime = 3600
findtime = 600
maxretry = 5

[sshd]
enabled = true
port = ssh
filter = sshd
maxretry = 3
bantime = 86400

Values in [sshd] take precedence over the same option in [DEFAULT]. If you want the SSH jail to use the shared one-hour ban and five-failure threshold instead, omit the four jail-specific overrides and leave only enabled, port and filter.

Understanding the settings before you tune them

Setting What it controls Example in this guide Practical consequence
ignoreip Addresses that are never banned by the jail 127.0.0.1/8 ::1 203.0.113.10 Protects administrators, but an incorrect or stale address can leave an account exposed to repeated attempts from that source.
bantime How long a matching address remains banned 3,600 seconds globally; 86,400 seconds for SSH Longer bans reduce repeat attempts but increase the cost of an accidental ban.
findtime The period in which failures are counted 600 seconds globally A burst of failures must occur inside this window to reach the threshold.
maxretry Failures allowed before a ban Five globally; three for SSH Lower values react sooner but are less forgiving of mistyped passwords or unstable keys.
backend How a jail reads events Not set in the basic example On a systemd-only host, setting backend = systemd can avoid dependence on a traditional log file.
action The firewall mechanism used to enforce a ban Distribution default Keep the packaged action unless you have confirmed that your firewall framework and Fail2ban version support a different one.

For example, with the SSH overrides above, an address that produces three filter-matching failures within the jail’s configured window receives a 24-hour ban. A fourth attempt after the window has expired starts a new count instead of being combined with the old events.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
BladeHawks RGB Gaming Mouse Pad Extra Large Extended 31.5x12 Inch-Black
  • 【Large size】:Measuring 800 x 300 mm/ 31. 5×12 inches, which is wider and taller than others. Large mouse pad can perfectly fit your keyboard and mouse of any size, and there is also ample space for peripherals such as phones, tablets, etc.
  • 【LED backlight mouse pad】:Blade Hawks RGB mouse pad provides 7 static modes and 7 dynamic modes will give you the options you are looking for. Power-off memory function remembers the last lighting mode you selected. The super glow fiber Chroma will give you a colorful gaming setup that you want.
  • 【Anti-slip rubber base】:Made from Natural rubber, this gaming mousepad will firmly grip your desktop, allowing you to enjoy the ultimate precision in the games you are most passionate about. It also comes with a texture that enhances this ability even further.
  • 【Smooth and waterproof surface】: Micro-textured cloth surface, for extremely precise mouse control and a smooth movement. When liquid splashes on the gaming mouse pad, it forms water droplets and slides down. Will not delay your work or gameplay.
  • 【Plug and play】: This mouse and keyboard pad is powered by USB, plug and play, no driver required. One button control light modes. Press one time to change the lighting mode, press twice to change the brightness, press and hold about 3 seconds turn ON/OFF.

When an SSH jail needs the systemd backend

Some current Linux installations keep SSH events in the systemd journal and do not create /var/log/auth.log. If Fail2ban reports that it cannot find a log file for the SSH jail, add the backend inside [sshd]:

[sshd]
enabled = true
port = ssh
filter = sshd
backend = systemd
maxretry = 3
bantime = 86400

The alternative is to install and configure rsyslog so that the traditional authentication log exists, then point the jail at that log according to your distribution’s layout. Do not assume that a path from one distribution applies to another. The important diagnostic is whether the selected backend can read the events that the sshd filter expects.

Reload Fail2ban and verify the merged configuration

  1. Reload the service after saving the file:

    sudo systemctl reload fail2ban

    If your service manager or package does not support that operation, use:

    sudo fail2ban-client reload
  2. List the active jails:

    sudo fail2ban-client status

    The output should include sshd. A jail that is absent is not active, even if its section appears in a file.

    Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  3. Inspect the SSH jail:

    sudo fail2ban-client status sshd

    This reports the jail’s current counters and banned addresses. It confirms that Fail2ban created the jail and can expose whether bans are accumulating.

    Rank #4
    Sale
    Vaydeer Wrist Rest for Keyboard and Mouse, Computer Ergonomic Wrist Support Pad, Soft Memory Foam Arm Cushion for Desk, Palm Hand Office Laptop Typing
    • 【Softer and More Comfortable】Vaydeer wrist rest has unique diamond pattern, which is the combination of softness and aesthetics. The materials of wrist rest are improved into higher quality memory foam and covered with silky smooth lycra. The computer wrist rest makes you as comfortable and cushiony as like rest your wrists on clouds.
    • 【Ergonomic Wrist Saver】The wrist rests for keyboard and mouse comes with a 17.32×3.15×0.83 inch keyboard wrist pad and a 5.94×3.15×0.83 inch mouse wrist support. Based on ergonomic design, the unique concave shape is the perfect fit for your wrist joints. The wrist rest pad fits most computer keyboards and laptops, improve hand and wrist posture, release your wrist and arm stress.
    • 【Non-Slip Rubber Bottom】Featuring an anti-skid silicone base on the bottom, this wrist keyboard support stays firmly in place on your desk, preventing the padding from sliding around, ensuring stable and consistent wrist support during extended computer sessions.
    • 【Better Experience & Pain Relief】Our keyboard arm rest is beneficial to alleviate the soreness caused by direct contact and friction between your arm and a hard desk surface, reducing the risk of wrist fatigue or carpal tunnel. The soft texture of memory foam can evenly distribute the pressure around your wrists and provide good support with just enough give.
    • 【Helpful in Multiple Scenarios】Whether you're working, studying, writing, typing, gaming, this keyboard and mouse rest combo is an essential accessory to add comfort and support to your hands and wrists. It’s also a great gift for men, women, family, friend, coworker, gamer, teacher, etc.
  4. Dump the merged configuration when you need to see what Fail2ban actually loaded:

    sudo fail2ban-client -d

    Search the dump for sshd, enabled, ignoreip, the backend and the action. This is more reliable than inspecting one file in isolation because later overrides may have changed its values.

Protect VPS from SSH brute force: an operating checklist

  • Use a fixed administrative address or a tightly controlled VPN subnet in ignoreip; remove addresses that are no longer under your control.
  • Choose findtime and maxretry together. A low retry limit over a long window is strict; a higher limit over a short window tolerates slower, human login mistakes.
  • Set a longer SSH-specific bantime only after confirming that you have an out-of-band recovery path or a trusted address that cannot be banned.
  • Watch the status output after deployment rather than assuming that an enabled jail is seeing events.
  • Record any local changes in jail.local or a dedicated file under /etc/fail2ban/jail.d/ so an administrator can understand which later override wins.
  • Review the installed manual before copying options from a tutorial. The available actions, defaults and backends are version-dependent.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

fail2ban sshd jail not working or not found

The jail does not appear in status

Check the three common causes first:

  1. enabled = true is missing or misspelled.
  2. The section name is not exactly [sshd], or another file defines a different name than the one you queried.
  3. A syntax error earlier in jail.local prevented the later section from being parsed as intended.

Run sudo fail2ban-client -d and inspect the service’s journal for parsing errors. Correct the file, reload Fail2ban and run sudo fail2ban-client status again.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The jail exists but never bans

First run sudo fail2ban-client status sshd. If the failure count remains at zero while you know failed logins occurred, verify the log source. A systemd host may need backend = systemd; a file-based setup may need rsyslog to create the expected authentication log. Also confirm that the SSH service is producing events that the installed sshd filter recognizes.

If counters increase but no address is banned, inspect the merged action and the host firewall. The jail can detect failures while an incompatible or unavailable action fails to enforce the block. Keep the action aligned with the firewall framework installed on the VPS.

Best Value
Sale
Under Desk Cable Management Tray No Drill, Metal Mesh Cable Management Under Desk with Clamp Mount, 2 Hole Cable Tray with Wire Management and Cord Organizer for Home Office Standing Desk
  • 【No Drill Mounted】Cable management tray can be assembled in as little as 3 minutes or less-simply. Side clips easily clampe the edge of desk, pass through the holes on the sides, and secure excess cables with baskets. Desk cable management supports inward or outward installation to meet your needs in different scenarios, and provides you with great convenience when collecting and organizing wires.
  • 【Rubber Pad Protects Desk】Wire organizer under desk built-in soft rubber pads on the clamp protect your desk from scratches, so you will not damage your furniture or office.
  • 【Sturdy and Beautiful】Cord management under desk is made of high-quality carbon steel and holds about 15 lbs. The wire basket has 2 holes on each side of the tray to enable your cables to pass freely. Cable baskets are suitable for desk thickness use from 0.4" to 2.4".
  • 【Space Saving & Keep Organized】Desk cable management tray holds all your power cords, outlet strips, USB hubs and computer transformers hidden from your feet, and the data cables will not enter the vacuum cleaner to keep your desk clean and tidy. Desk wire organizer is also suitable for use in the kitchen and outdoors.
  • 【Reduce Safety Risks】Cable tray under desk keeps all plugs away from your kids, no more worry about tripping. Using 2 holes wire tray saves extra space, helps you easily cabling and wire protection. The mesh design is not easy to accumulate dust, but avoids safety accidents caused by messy wires.

fail2ban Ubuntu no log file for sshd

This message means the jail is configured to read a file that is not present, not necessarily that SSH has no authentication events. On a systemd-based Ubuntu installation, add backend = systemd under [sshd] and reload. If you prefer file-based processing, install and configure rsyslog so /var/log/auth.log is generated, then ensure the jail’s log path matches the actual file. Verify the result with sudo fail2ban-client status sshd and the merged dump.

Do not create an empty log file merely to silence the error: an empty file gives the filter nothing to match. The backend must point to the source where the SSH daemon is really writing events.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Recovering from an accidental ban

If you can still connect from an address listed in ignoreip, use that session to inspect the jail. If the address is currently banned, remove it with the client command supported by your installed Fail2ban version, then correct ignoreip before testing again. Keep a second administrative path open while making the change. The exact unban command and action syntax can vary by release, so consult the local fail2ban-client help rather than copying a command intended for another version.

Optional escalating bans and nftables actions

Some Fail2ban versions support escalating bans with options such as bantime.increment = true, a multiplication factor and a maximum ban time. The Kernelhost example also uses an nftables action. These are optional, version-dependent features: confirm that your installed release documents them and that nftables is the firewall framework actually active on the VPS before adding them. Introduce one change at a time, reload, and verify the resulting action with fail2ban-client -d.

Keeping the configuration maintainable

Keep local policy in jail.local or narrowly scoped files in /etc/fail2ban/jail.d/, rather than copying the entire packaged jail.conf. When a package upgrade changes a filter, backend or default, compare the new manual with your local overrides. The local file should state the values you intentionally changed, while inherited defaults remain visible in the merged dump. This approach makes precedence predictable and avoids losing protection when a distribution replaces its packaged configuration.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.