# Fail2ban not working

**URL:** https://dietpi.com/forum/t/fail2ban-not-working/4517
**Category:** Troubleshooting
**Created:** [7 October 2020 08:11 UTC](https://dietpi.com/forum/t/fail2ban-not-working/4517 "2020-10-07T08:11:25Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![mafioso12dk](https://dietpi.com/forum/letter_avatar_proxy/v4/letter/m/858c86/32.png) [@mafioso12dk](https://dietpi.com/forum/u/mafioso12dk)
#### Post date: [7 October 2020 08:11 UTC](https://dietpi.com/forum/t/fail2ban-not-working/4517/1 "2020-10-07T08:11:25Z")

</div>

I made a new installation with RealVCN, fail2ban, samba, nextcloud, rpi-monitor and chromium. I checked today if fail2ban is even working and that’s what I’ve got:

```nohighlight
dietpi@DietPi:~$ fail2ban-client status dropbear
 Failed to access socket path: /var/run/fail2ban/fail2ban.sock. Is fail2ban running?

```

I checked the path _/var/run/fail2ban_ and there is no file/folder fail2ban.sock

Anyone knows where is the problem?

Thank you in advance

---

<div class="post-metadata">

### Author: ![Joulinar](https://dietpi.com/forum/user_avatar/dietpi.com/joulinar/32/57_2.png) [@Joulinar](https://dietpi.com/forum/u/Joulinar)
#### Post date: [7 October 2020 11:00 UTC](https://dietpi.com/forum/t/fail2ban-not-working/4517/2 "2020-10-07T11:00:38Z")

</div>

Hi,

many thanks for your message. I guess your service is not running. Pls can you check

```nohighlight
systemctl status fail2ban.service

```

If you see something like the following, a value within config file is missing

```nohighlight
Oct 07 12:52:31 DietPi3 fail2ban-server[683]: Failed during configuration: Bad value substitution: option 'filter' in section 'dropbear' contains an interpolation key 'mode' which is not a valid option name. Raw value: '%( __name__ )s[mode=%(mode)s]'

```

A quick fix would be following

```nohighlight
nano /etc/fail2ban/jail.conf

```

And add mode = normal before filter. Should looks like this

```nohighlight
[DEFAULT]
enabled = true
ignoreip = 127.0.0.1/8
ignorecommand =
backend = systemd
mode = normal
filter = %( __name__ )s[mode=%(mode)s]
findtime = 600

```

Once done save the file and restart the service

```nohighlight
systemctl restart fail2ban.service
systemctl status fail2ban.service

```

Status should be active (running) now

---

<div class="post-metadata">

### Author: ![mafioso12dk](https://dietpi.com/forum/letter_avatar_proxy/v4/letter/m/858c86/32.png) [@mafioso12dk](https://dietpi.com/forum/u/mafioso12dk)
#### Post date: [7 October 2020 15:30 UTC](https://dietpi.com/forum/t/fail2ban-not-working/4517/3 "2020-10-07T15:30:51Z")

</div>

After status check I got this message:

```nohighlight
dietpi@DietPi:~$ systemctl status fail2ban.service
● fail2ban.service - Fail2Ban Service
   Loaded: loaded (/lib/systemd/system/fail2ban.service; enabled; vendor preset:
 enabled)
   Active: failed (Result: exit-code) since Wed 2020-10-07 10:49:56 B
ST; 5h 34min ago
     Docs: man:fail2ban(1)
  Process: 487 ExecStartPre=/bin/mkdir -p /var/run/fail2ban (code=exited, status
=0/SUCCESS)
  Process: 491 ExecStart=/usr/bin/fail2ban-server -xf start (code=exited
, status=255/EXCEPTION)
 Main PID: 491 (code=exited, status=255/EXCEPTION)

```

But your method helped. Now it works. Thanks for help

---

<div class="post-metadata">

### Author: ![Joulinar](https://dietpi.com/forum/user_avatar/dietpi.com/joulinar/32/57_2.png) [@Joulinar](https://dietpi.com/forum/u/Joulinar)
#### Post date: [7 October 2020 15:40 UTC](https://dietpi.com/forum/t/fail2ban-not-working/4517/4 "2020-10-07T15:40:00Z")

</div>

ok good that it is working now.

---

<div class="post-metadata">

### Author: ![MichaIng](https://dietpi.com/forum/user_avatar/dietpi.com/michaing/32/7_2.png) [@MichaIng](https://dietpi.com/forum/u/MichaIng)
#### Post date: [7 October 2020 16:18 UTC](https://dietpi.com/forum/t/fail2ban-not-working/4517/5 "2020-10-07T16:18:59Z")

</div>

Many thanks for reporting. But mafioso12dk does your service status still shows a failing state, or was this before the fix? In case check again, or the logs only:  
journalctl -u fail2ban

---

<div class="post-metadata">

### Author: ![Joulinar](https://dietpi.com/forum/user_avatar/dietpi.com/joulinar/32/57_2.png) [@Joulinar](https://dietpi.com/forum/u/Joulinar)
#### Post date: [7 October 2020 17:45 UTC](https://dietpi.com/forum/t/fail2ban-not-working/4517/6 "2020-10-07T17:45:14Z")

</div>

MichaIng  
It’s working now, if I understood correctly
