Fail2Ban Will Not Start - linux

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!

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.

You need to set the appropriate rights on the mentioned directory:
drwxr-xr-x root:root

You should set the permissions like this: chmod -R 644 /var/run/fail2ban/

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.

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!

Related

Snap-confine has elevated permissions and is not confined but should be. Is there a permanent fix?

lately I've been getting an error for some applications. They are not working as normally before. I think some system update caused this issue. I'm using ubuntu 22.04.
I've already check this: Snap-confine has elevated permissions and is not confined but should be. Refusing to continue to avoid permission escalation attacks
and Diego V's answer is working for me. However, it only works until system reboot, after system restart the problem is re-occurring, and I have to do the fix (with the cmds) every time after reboot. Is there a permanent fix for this problem ?
I was having the exact same issue (also on Ubuntu 22.04) and found that apparmor was inactive:
$ systemctl status apparmor
I enabled apparmor:
$ sudo systemctl enable apparmor
which starts appormor at boot (it does not start it in the current session: sudo systemctl start apparmor).
https://www.linuxcapable.com/how-to-enable-disable-apparmor-on-ubuntu-22-04-lts
I don't have rights to comment so I can only reply here that it remains an issu and like Null I seek an answer other than provided by Diego V, which works until reboot where apparmor is already enabled/running so doesn't require trekerj's answer.

ubuntu backup-manager Permission denied

I've recently installed backup manager onto my ubuntu machine to have automated backup going. The problem is when I go to set up the automatization using this code -
it comes us up saying this "bash: /etc/backup-manager.sh: Permission denied"
I do not understand this error. I've tried change the user who read/writes to someone other than root and that didn't work. I tried changed the chmod number from 770 to 700 and still didn't work.
any info on this is welcome. Thank you to those who help :)
those wondering I am using this tutorial giving to me by the host. https://documentation.online.net/en/dedicated-server/tutorials/backup/configure-backup/start
I'm using the desktop version of ubuntu 16 incase that is needed
The sudo doesn't do what you want in this case. What happens is that the shell evaluates the redirection and attempts to open the /etc/backup-manager.sh for you before the sudo cat even gets started. That fails because the shell still runs as you unprivileged user. You have to say sudo -i to open a new root shell, execute the commands and exit again.
Alternatively you could try sudo nano /etc/backup-manager.sh and paste the contents there. This would work because the editor is run as root and does the file opening itself when you save.

RStudio cannot reach .Rhistory on Ubuntu

I was working with markdown file on RStudio. I have Ubuntu 14.04 on my laptop. I produce html files using knitr. I decided to clean my enviroment and added rm and gc commands at the end.
Now here is a message in my console window:
Error attempting to read history from ~/.Rhistory: permission denied (is the .Rhistory file owned by root?)
What it means? Is it bad for my code?
You are right - the first time you ran it, you were in sudo mode, and the .Rhistory file was created with root as the owner. Running RStudio as root would remove the symptom, but is not ideal. To be able to run it as a regular user, simply change the owner of the .Rhistory file:
sudo chown -c <user_name> .Rhistory
In the best traditions of stackoverflow I reply to my own question! The problem occurred because when I first started R, I did it as su:
sudo R
so I can load a lot of useful libraries in /usr/lib/R/site-library and not in my account. As result .Rhistory became su file. It is possible for RStudio to see it if it is started as
sudo rstudio
and then all is fine.

Linux CentOS 7 autofs does not mount network share after reboot

Problem:
I have CentOS 7 Linux VM with cifs installed. I added a mount point using autofs where the whole idea was to automatically mount a network share every time VM boots. However, when I run this command:
ls /mnt/vmshare/trinity
I get
ls: cannot access /mnt/vmshare/trinity: No such file or directory
Workaround:
What I'm having to do is run this command after each reboot
/sbin/service autofs start
Then I can see the files in trinity.
Maybe autofs does not even start by default on reboot. How to make sure autofs starts on reboot? Or in general, how to solve my problem above?
Thanks so much!
for CentOS 7:
systemctl enable autofs
check with:
systemctl is-enabled autofs
I don't recall exactly what I used to figure this one out, but maybe it will get you on the right track.
I did some research on this a few years ago, and I believe the term you're looking for is "persistent mount."
You'll need to create or find the local mount point for your network directory. For instance, in mine.. /media/disco/disknamehere.../.../Share
This must be added to /etc/fstab with the correct options in place. Sorry I couldn't be more help.
Try to run
chkconfig autofs on
that will enable autofs service to start on boot.

God : Unable to start without sudo

When I run god without sudo then god is not able to find event system . However when I run with sudo god able to find event system.
$ god -V
Version: 0.13.2
Polls: enabled
Events: none
$ sudo god -V
Version: 0.13.2
Polls: enabled
Events: netlink
about My M/c .. I'm using "Linux 3.2.0-38-virtual #61-Ubuntu SMP Tue Feb 19 12:37:47 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux"
Please help me
Reading the God website:
you need to sudo if you're using events on Linux or want to use the setuid/setgid functionality
System event listening require root permissions, so sudo is required. Also, if you want god to spawn processes under different user ID from your own, sudo is equally required. This is the basic permission requirement in UNIX.

Resources