Reputation: 492
I am running Centos 6.5 (Kernel Linux jspring 2.6.32-431.el6.x86_64 #1 SMP Fri Nov 22 03:15:09 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux)
and I was wondering if someone could assist - Im installing Fail2Ban through yum however when I go to run it I am getting the following error;
service fail2ban start
Starting fail2ban: ERROR Directory /var/run/fail2ban exists but not accessible for writing
[FAILED]
If anyone could advise me how to fix this that would be great.
Thanks!
Upvotes: 2
Views: 3498
Reputation: 1013
You need to set the appropriate rights on the mentioned directory:
drwxr-xr-x root:root
Upvotes: 0
Reputation: 1391
As is documented in the official commands list here the command fail2ban start <jail>
is clearly used to start jails and not to start fail2ban
. So you completely missunderstood it's usage.
Try to first stop and then quickly start again the jail sshd
that is enabled by default:
fail2ban-client stop sshd
fail2ban-client start sshd
Hey! It works!
Upvotes: 0
Reputation: 1368
As people have mentioned, this is clearly a permissions issue. I'm not sure if this applies to your version but fail2ban in 2018 has a client, run as:
sudo fail2ban-client start
(or restart
or status
). It must be run as sudo though.
Upvotes: 0
Reputation: 5107
There are several things that could be causing this.
First make sure the permissions and ownership are correct as the other answers state. The directory permissions should be drwxr-xr-x
(a.k.a. 644) and it should be owned by root:root
.
Now make sure you are attempting to run the start command with the proper authority. If service fail2ban start
does not work, try sudo service fail2ban start
. Using sudo is recommended but you could also switch to or login as the root user.
You may also want to reboot after you get it running and then run sudo service fail2ban status
to make sure it successfully started up again.
Upvotes: 2
Reputation: 161
You should set the permissions like this: chmod -R 644 /var/run/fail2ban/
Upvotes: 0