# Fail2ban - Great tutorial - securing your server

**URL:** <https://community.learnlinux.tv/t/fail2ban-great-tutorial-securing-your-server/1759>\
**Category:** Linux on Servers\
**Created:** [July 31, 2022, 12:47pm UTC](https://community.learnlinux.tv/t/fail2ban-great-tutorial-securing-your-server/1759 "2022-07-31T12:47:18Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![AnOldSlowHorse](https://community.learnlinux.tv/letter_avatar_proxy/v4/letter/a/87869e/32.png) [@AnOldSlowHorse](https://community.learnlinux.tv/u/AnOldSlowHorse)\
**Post date:** [July 31, 2022, 12:47pm UTC](https://community.learnlinux.tv/t/fail2ban-great-tutorial-securing-your-server/1759/1 "2022-07-31T12:47:18Z")

</div>

ail2ban Securing your sever.  
I watch this tutorial video by Jay on securing your server (see link)

[![](https://community.learnlinux.tv/uploads/default/original/1X/25094fcef3f134a4ee513bb44986bfbff2292633.jpeg "Fail2ban Tutorial | How to Secure Your Server") ](https://www.youtube.com/watch?v=kgdoVeyoO2E&t=315s)

I’m new to Linux and recently created my own server, from the link on Jays website(see link)

> **[Impact Affiliate Referrals Page - $100](https://www.linode.com/lp/affiliate-referral/?irclickid=VbTShixzQxyNU7sXl92I7WbRUkD3ezTfIXRewQ0&irgwc=1&utm_source=LearnLinuxTV&utm_medium=affiliate&utm_campaign=impact)**
>
> Cut Your Cloud Bills in Half Deploy more with Linux virtual machines, global infrastructure, and simple pricing. No surprise bills, no lock-in, and the

This tutorial for fail2ban was extremely helpful to me.  
I’ve enable a number of jails and all appears to be working very well.

If any is using fail2ban and have anything they’d would like to share, I’d be interested in that…

---

<div class="post-metadata">

**Author:** ![Mr\_McBride](https://community.learnlinux.tv/letter_avatar_proxy/v4/letter/m/a698b9/32.png) [@Mr\_McBride](https://community.learnlinux.tv/u/Mr_McBride)\
**Post date:** [July 31, 2022, 1:03pm UTC](https://community.learnlinux.tv/t/fail2ban-great-tutorial-securing-your-server/1759/2 "2022-07-31T13:03:10Z")

</div>

Welcome to the forum @AnOldSlowHorse, and thanks for posting.

I used to use fail2ban, but I’ve moved to crowdsec now.

Both are excellent tools, though.

---

<div class="post-metadata">

**Author:** ![AnOldSlowHorse](https://community.learnlinux.tv/letter_avatar_proxy/v4/letter/a/87869e/32.png) [@AnOldSlowHorse](https://community.learnlinux.tv/u/AnOldSlowHorse)\
**Post date:** [July 31, 2022, 1:11pm UTC](https://community.learnlinux.tv/t/fail2ban-great-tutorial-securing-your-server/1759/3 "2022-07-31T13:11:13Z")

</div>

Thanks for your reply @Mr_McBride ,  
I will have a read about crowdsec.

Its nice to see what’s available.

---

<div class="post-metadata">

**Author:** ![hypoiodous](https://community.learnlinux.tv/letter_avatar_proxy/v4/letter/h/f475e1/32.png) [@hypoiodous](https://community.learnlinux.tv/u/hypoiodous)\
**Post date:** [August 5, 2022, 10:16am UTC](https://community.learnlinux.tv/t/fail2ban-great-tutorial-securing-your-server/1759/4 "2022-08-05T10:16:51Z")

</div>

You might find yourself locked out of the server if you attempt to connect multiple times… it has happened to me when moving to a separate machine and separate username, such that the path to the ssh key was different and the attempt to log in was blocked.

```auto
# Will show you the number of jails
sudo fail2ban-client status

# For ssh is most likely set as sshd
# This command will show you the total banned IP addresses
sudo fail2ban-client status sshd

# Use this command to unban a particular IP if you get locked out of your system
sudo fail2ban-client set sshd unban ip xx.xx.xx.xx

```

Making mistakes is learning! 😃

---

<div class="post-metadata">

**Author:** ![AnOldSlowHorse](https://community.learnlinux.tv/letter_avatar_proxy/v4/letter/a/87869e/32.png) [@AnOldSlowHorse](https://community.learnlinux.tv/u/AnOldSlowHorse)\
**Post date:** [August 5, 2022, 10:43am UTC](https://community.learnlinux.tv/t/fail2ban-great-tutorial-securing-your-server/1759/5 "2022-08-05T10:43:45Z")

</div>

Hi, thank you for that tip.

I’ve made a note of it, so I can refer back.

Im on a very steep learning curve at the moment and all tips are welcome.

In Jay video (Using Fail2ban) about 5 minutes in,

He shows how to add your IP address (s) to a list in fail2ban jail.local file, so your IP address ignored and not jailed.

I added two IP address I use daily to the jail.local file, with a space in between them (not if this relevant as I’m very new to Linux and servers) …

 ![Screenshot 2022-08-05 at 11.28.44](https://community.learnlinux.tv/uploads/default/original/1X/4802bc992c74c1b0156072f239070e35961f1f00.jpeg)

---

<div class="post-metadata">

**Author:** ![Mr\_McBride](https://community.learnlinux.tv/letter_avatar_proxy/v4/letter/m/a698b9/32.png) [@Mr\_McBride](https://community.learnlinux.tv/u/Mr_McBride)\
**Post date:** [August 5, 2022, 12:22pm UTC](https://community.learnlinux.tv/t/fail2ban-great-tutorial-securing-your-server/1759/6 "2022-08-05T12:22:58Z")

</div>

You _can_ create a configuration where root is not allowed to login directly via SSH, but is allowed to login at the console (assuming you have physical access to the host). That might be an acceptable backdoor.

---

<div class="post-metadata">

**Author:** ![AnOldSlowHorse](https://community.learnlinux.tv/letter_avatar_proxy/v4/letter/a/87869e/32.png) [@AnOldSlowHorse](https://community.learnlinux.tv/u/AnOldSlowHorse)\
**Post date:** [August 5, 2022, 12:27pm UTC](https://community.learnlinux.tv/t/fail2ban-great-tutorial-securing-your-server/1759/7 "2022-08-05T12:27:37Z")

</div>

Thanks for your reply, I have so much to learn …

---

<div class="post-metadata">

**Author:** ![Mr\_McBride](https://community.learnlinux.tv/letter_avatar_proxy/v4/letter/m/a698b9/32.png) [@Mr\_McBride](https://community.learnlinux.tv/u/Mr_McBride)\
**Post date:** [August 5, 2022, 12:39pm UTC](https://community.learnlinux.tv/t/fail2ban-great-tutorial-securing-your-server/1759/8 "2022-08-05T12:39:18Z")

</div>

We are all on the journey of learning. I.T. never stops changing…
