> For the complete documentation index, see [llms.txt](https://lodestone-technologies.gitbook.io/knowledgebase/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://lodestone-technologies.gitbook.io/knowledgebase/dedicated-hosting/configure-fail2ban.md).

# Configure Fail2Ban

Fail2Ban is a daemon that can be used to monitor the logs of services and ban clients that repeatedly fail authentication checks.

You will need to be using a Unix-based operating system such as Ubuntu.&#x20;

Log in to your server as `root` and execute `apt install fail2ban` to install Fail2Ban. You can then execute `systemctl start fail2ban` to enable the service.

To configure Fail2Ban, create local configuration files by executing `cp /etc/fail2ban/fail2ban.conf /etc/fail2ban/fail2ban.local` and then `cp /etc/fail2ban/jail.conf /etc/fail2ban/jail.local`.

{% hint style="warning" %}
Creating local files is important to avoid overwriting data when you upgrade Fail2Ban.&#x20;
{% endhint %}

Execute `nano /etc/fail2ban/jail.local` to edit the local configuration file. You can then adjust the configuration accordingly, such as changing the maximum number of attempts or default ban time.

Once done, save the file and exit the editor.

Execute `systemctl restart fail2ban` to apply the changes.

You can check the status of Fail2Ban by executing `systemctl status fail2ban` and view the current jails by executing `fail2ban-client status`.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://lodestone-technologies.gitbook.io/knowledgebase/dedicated-hosting/configure-fail2ban.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
