{"id":39239,"date":"2021-10-18T12:30:00","date_gmt":"2021-10-18T17:30:00","guid":{"rendered":"https:\/\/www.rosehosting.com\/blog\/?p=39239"},"modified":"2022-06-03T03:31:31","modified_gmt":"2022-06-03T08:31:31","slug":"how-to-install-and-configure-fail2ban-on-ubuntu-20-04","status":"publish","type":"post","link":"https:\/\/www.rosehosting.com\/blog\/how-to-install-and-configure-fail2ban-on-ubuntu-20-04\/","title":{"rendered":"How to Install and Configure Fail2ban on Ubuntu 20.04"},"content":{"rendered":"<div id=\"bsf_rt_marker\"><\/div>\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"742\" height=\"372\" src=\"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2021\/10\/how-to-install-and-configure-fail2ban-on-ubuntu-20.04.jpg\" alt=\"how to install and configure fail2ban on ubuntu 20.04\" class=\"wp-image-39271\" srcset=\"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2021\/10\/how-to-install-and-configure-fail2ban-on-ubuntu-20.04.jpg 742w, https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2021\/10\/how-to-install-and-configure-fail2ban-on-ubuntu-20.04-300x150.jpg 300w, https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2021\/10\/how-to-install-and-configure-fail2ban-on-ubuntu-20.04-150x75.jpg 150w\" sizes=\"(max-width: 742px) 100vw, 742px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">In this article, we will explain how to install Fail2ban on Ubuntu 20.04. Fail2ban is an open-source tool used to help you protect your server from cyber-attacks. Fail2ban can detect brute-force and other automated attacks, by scanning your log files searching for the offending IPs. <\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"alignright size-large is-resized\"><img decoding=\"async\" src=\"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2021\/10\/installing-and-configuring-fail2ban-on-ubuntu-20.04-1024x1024.jpg\" alt=\"installing and configuring fail2ban on ubuntu 20.04\" class=\"wp-image-39272\" width=\"127\" height=\"127\"\/><\/figure><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">When the attacker&#8217;s IP addresses are found those IPs are then banned for a specific length of time. You will learn in few easy steps about how to install it on Ubuntu 20.04. The installation will take no more than 5 minutes. So, let&#8217;s get started!<\/p>\n\n\n\n<!--more-->\n\n\n\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_83 counter-hierarchy ez-toc-counter ez-toc-transparent ez-toc-container-direction\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<label for=\"ez-toc-cssicon-toggle-item-6a182f98d5619\" class=\"ez-toc-cssicon-toggle-label\"><span class=\"ez-toc-cssicon\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/label><input type=\"checkbox\"  id=\"ez-toc-cssicon-toggle-item-6a182f98d5619\"  aria-label=\"Toggle\" \/><nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/www.rosehosting.com\/blog\/how-to-install-and-configure-fail2ban-on-ubuntu-20-04\/#Prerequisites\" >Prerequisites<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/www.rosehosting.com\/blog\/how-to-install-and-configure-fail2ban-on-ubuntu-20-04\/#Step-1-Fail2ban-installation\" >Step 1. Fail2ban installation<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/www.rosehosting.com\/blog\/how-to-install-and-configure-fail2ban-on-ubuntu-20-04\/#Step-2-Fail2ban-Configuration\" >Step 2. Fail2ban Configuration<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/www.rosehosting.com\/blog\/how-to-install-and-configure-fail2ban-on-ubuntu-20-04\/#Step-3-Email-notifications\" >Step 3. Email notifications<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/www.rosehosting.com\/blog\/how-to-install-and-configure-fail2ban-on-ubuntu-20-04\/#Step-4-Fail2ban-jails\" >Step 4. Fail2ban jails<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/www.rosehosting.com\/blog\/how-to-install-and-configure-fail2ban-on-ubuntu-20-04\/#Step-5-Fail2ban-client\" >Step 5. Fail2ban client<\/a><\/li><\/ul><\/nav><\/div>\n<h2 class=\"wp-block-heading\" id=\"h-prerequisites\"><span class=\"ez-toc-section\" id=\"Prerequisites\"><\/span>Prerequisites<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<ul class=\"wp-block-list\"><li>Fresh install of Ubuntu 20.04<\/li><li>User privileges: root or non-root user with sudo privileges<\/li><\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">As always, first log in to your VPS via SSH:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ssh user@hostname<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-step-1-fail2ban-installation\"><span class=\"ez-toc-section\" id=\"Step-1-Fail2ban-installation\"><\/span>Step 1. Fail2ban installation<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Fail2ban is available in the default Ubuntu 20.04 repositories, you will just need to update Apt cache and install the fail2ban package.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ sudo apt update\n\n$ sudo apt install fail2ban<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Fail2ban starts automatically after the installation, verify this by running:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ sudo systemctl status fail2ban<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-step-2-fail2ban-configuration\"><span class=\"ez-toc-section\" id=\"Step-2-Fail2ban-Configuration\"><\/span> Step 2. Fail2ban Configuration<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">You can find the Fail2ban configuration files in the <strong>\/etc\/fail2ban <\/strong>directory.<br>Before you start editing the default settings, first you will need to make a copy of the <strong>\/etc\/fail2ban\/jail.conf<\/strong> file.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ sudo cp \/etc\/fail2ban\/jail.conf \/etc\/fail2ban\/jail.local<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Then open the jail.local file using your text editor of choice.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ sudo nano \/etc\/fail2ban\/jail.local<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The <strong>ignoreip <\/strong>directive is used to exclude IP addresses, subnets or IP ranges from getting banned. You can do that by removing the comment from the <strong>ignoreip <\/strong>line and adding the IP addresses at the end, that you want to exclude separated by space between them.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">For example, if you want to exclude the IP addresses 10.10.10.5 and 10.10.10.80 from being banned, add the IP addresses at the end of the line with space between.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ignoreip = 127.0.0.1\/8 ::1 10.10.10.5 10.10.10.80<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Changing the ban settings can be done with the parameters <strong>bantime<\/strong>, <strong>findtime <\/strong>and <strong>maxretry<\/strong>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>bantime <\/strong>is the duration of the ban time for the banned IP addresses. By default, the value is 10 minutes, but it can be also set to a number of days. Using negative values for <strong>bantime<\/strong> makes the ban duration permanent.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The other parameter<strong> findtime <\/strong>tells us the duration in which the failed attempts should happen before they get banned.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>maxretry <\/strong>value<strong> <\/strong>defines the number of failed login attempts that should be made in the duration defined in <strong>findtime<\/strong> to get the IP banned.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-step-3-email-notifications\"><span class=\"ez-toc-section\" id=\"Step-3-Email-notifications\"><\/span>Step 3. Email notifications<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">If you have SMTP server installed and configured, you can also enable email notifications to get alerts when some IP has been banned.<br>To do that, set the global parameter <strong>destemail<\/strong> with the email where you want to receive the alerts and add the line below.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>action = %(action_mw)s<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">This will send you emails of the banned IPs together with a detailed whois report.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-step-4-fail2ban-jails\"><span class=\"ez-toc-section\" id=\"Step-4-Fail2ban-jails\"><\/span>Step 4. Fail2ban jails<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Fail2ban uses jails to apply rules on a given application or log file. Jails are basically a service that includes filters and actions, the log entries are checked and if they match a predefined condition then those IPs are banned.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The <strong>sshd<\/strong> jail is enabled by default and you can find it at the top of the jails list.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;sshd]\n\n# To use more aggressive sshd modes set filter parameter \"mode\" in jail.local:\n# normal (default), ddos, extra or aggressive (combines all).\n# See \"tests\/files\/logs\/sshd\" or \"filter.d\/sshd.conf\" for usage example and details.\n#mode   = normal\nport    = ssh\nlogpath = %(sshd_log)s\nbackend = %(sshd_backend)s\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Each time you plan to make changes in the configuration file, you should restart the service after editing for the changes to take effect.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ sudo systemctl restart fail2ban<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">To enable some other jails, you will need to add <strong>enabled = true<\/strong> under the service name of the jail. You can also create your own jails for other services or log files.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-step-5-fail2ban-client\"><span class=\"ez-toc-section\" id=\"Step-5-Fail2ban-client\"><\/span>Step 5. Fail2ban client<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Fail2ban comes with a command-line tool <strong>fail2ban-client <\/strong>which can be used to run commands that interact with the fail2ban service. You can use the tool to check the jail status, ban or unban IP addresses and for changing other settings.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">To check jail status use the following command:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ sudo fail2ban-client status sshd<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">To ban an IP use the command:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ sudo fail2ban-client set sshd banip 61.52.43.34<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">You can unban an IP you can use the following command:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ sudo fail2ban-client set sshd unbanip 61.52.43.34<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Congratulations! you have successfully installed configured Fail2ban on Ubuntu 20.04.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Of course, you don\u2019t need to install and configure Fail2ban on Ubuntu 20.04 yourself if you use one of our <strong><a href=\"https:\/\/www.rosehosting.com\/linux-vps-hosting\/\" target=\"_blank\" rel=\"noreferrer noopener\">Linux VPS Hosting<\/a><\/strong> services and have additional IP addresses. In which case you can simply ask our expert Linux admins to configure and set this up for you. They are available 24\u00d77 and will take care of your request immediately.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"alignleft size-large is-resized\"><img decoding=\"async\" src=\"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2021\/10\/how-to-install-fail2ban-on-ubuntu-20.04-1024x1024.png?v=1633943235\" alt=\"how to install fail2ban on ubuntu 20.04\" class=\"wp-image-39274\" width=\"119\" height=\"119\" srcset=\"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2021\/10\/how-to-install-fail2ban-on-ubuntu-20.04-1024x1024.png 1024w, https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2021\/10\/how-to-install-fail2ban-on-ubuntu-20.04-300x300.png 300w, https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2021\/10\/how-to-install-fail2ban-on-ubuntu-20.04-150x150.png 150w, https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2021\/10\/how-to-install-fail2ban-on-ubuntu-20.04-768x768.png 768w, https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2021\/10\/how-to-install-fail2ban-on-ubuntu-20.04.png 1200w\" sizes=\"(max-width: 119px) 100vw, 119px\" \/><\/figure><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">PS. If you liked this post on How To install and configure Fail2ban on Ubuntu 20.04, please share it with your friends on the social networks by using the buttons on the left, or simply leave a reply below. Thanks.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this article, we will explain how to install Fail2ban on Ubuntu 20.04. Fail2ban is an open-source tool used to &#8230; <\/p>\n<p class=\"read-more-container\"><a title=\"How to Install and Configure Fail2ban on Ubuntu 20.04\" class=\"read-more button\" href=\"https:\/\/www.rosehosting.com\/blog\/how-to-install-and-configure-fail2ban-on-ubuntu-20-04\/#more-39239\" aria-label=\"Read more about How to Install and Configure Fail2ban on Ubuntu 20.04\">Read More<\/a><\/p>\n","protected":false},"author":4,"featured_media":39271,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[13,1698],"tags":[280,1603,1839],"class_list":["post-39239","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tutorials","category-ubuntu","tag-fail2ban","tag-how-to-install","tag-ubuntu-20-04","generate-columns","tablet-grid-50","mobile-grid-100","grid-parent","grid-33"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v27.6.1 (Yoast SEO v27.7) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>How To Install and Configure Fail2Ban on Ubuntu 20.04 | RoseHosting<\/title>\n<meta name=\"description\" content=\"Learn how to install and configure Fail2Ban on Ubuntu 20.04. Fail2Ban is a framework that protects computer servers from attacks.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.rosehosting.com\/blog\/how-to-install-and-configure-fail2ban-on-ubuntu-20-04\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How To Install and Configure Fail2Ban on Ubuntu 20.04 | RoseHosting\" \/>\n<meta property=\"og:description\" content=\"Learn how to install and configure Fail2Ban on Ubuntu 20.04. Fail2Ban is a framework that protects computer servers from attacks.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.rosehosting.com\/blog\/how-to-install-and-configure-fail2ban-on-ubuntu-20-04\/\" \/>\n<meta property=\"og:site_name\" content=\"RoseHosting\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/RoseHosting\" \/>\n<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/rosehosting.helpdesk\" \/>\n<meta property=\"article:published_time\" content=\"2021-10-18T17:30:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-06-03T08:31:31+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2021\/10\/how-to-install-and-configure-fail2ban-on-ubuntu-20.04.jpg?v=1633941388\" \/>\n\t<meta property=\"og:image:width\" content=\"742\" \/>\n\t<meta property=\"og:image:height\" content=\"372\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Jeff Wilson\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:title\" content=\"How To Install and Configure Fail2Ban on Ubuntu 20.04 | RoseHosting\" \/>\n<meta name=\"twitter:description\" content=\"Learn how to install and configure Fail2Ban on Ubuntu 20.04. Fail2Ban is a framework that protects computer servers from attacks.\" \/>\n<meta name=\"twitter:creator\" content=\"@rosehosting\" \/>\n<meta name=\"twitter:site\" content=\"@rosehosting\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Jeff Wilson\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/how-to-install-and-configure-fail2ban-on-ubuntu-20-04\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/how-to-install-and-configure-fail2ban-on-ubuntu-20-04\\\/\"},\"author\":{\"name\":\"Jeff Wilson\",\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/#\\\/schema\\\/person\\\/7ce77a842fa6a9a7f8efa186f2353713\"},\"headline\":\"How to Install and Configure Fail2ban on Ubuntu 20.04\",\"datePublished\":\"2021-10-18T17:30:00+00:00\",\"dateModified\":\"2022-06-03T08:31:31+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/how-to-install-and-configure-fail2ban-on-ubuntu-20-04\\\/\"},\"wordCount\":754,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/how-to-install-and-configure-fail2ban-on-ubuntu-20-04\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/wp-content\\\/uploads\\\/2021\\\/10\\\/how-to-install-and-configure-fail2ban-on-ubuntu-20.04.jpg\",\"keywords\":[\"fail2ban\",\"how to install\",\"Ubuntu 20.04\"],\"articleSection\":[\"Tutorials\",\"Ubuntu\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/how-to-install-and-configure-fail2ban-on-ubuntu-20-04\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/how-to-install-and-configure-fail2ban-on-ubuntu-20-04\\\/\",\"url\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/how-to-install-and-configure-fail2ban-on-ubuntu-20-04\\\/\",\"name\":\"How To Install and Configure Fail2Ban on Ubuntu 20.04 | RoseHosting\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/how-to-install-and-configure-fail2ban-on-ubuntu-20-04\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/how-to-install-and-configure-fail2ban-on-ubuntu-20-04\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/wp-content\\\/uploads\\\/2021\\\/10\\\/how-to-install-and-configure-fail2ban-on-ubuntu-20.04.jpg\",\"datePublished\":\"2021-10-18T17:30:00+00:00\",\"dateModified\":\"2022-06-03T08:31:31+00:00\",\"description\":\"Learn how to install and configure Fail2Ban on Ubuntu 20.04. Fail2Ban is a framework that protects computer servers from attacks.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/how-to-install-and-configure-fail2ban-on-ubuntu-20-04\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/how-to-install-and-configure-fail2ban-on-ubuntu-20-04\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/how-to-install-and-configure-fail2ban-on-ubuntu-20-04\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/wp-content\\\/uploads\\\/2021\\\/10\\\/how-to-install-and-configure-fail2ban-on-ubuntu-20.04.jpg\",\"contentUrl\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/wp-content\\\/uploads\\\/2021\\\/10\\\/how-to-install-and-configure-fail2ban-on-ubuntu-20.04.jpg\",\"width\":742,\"height\":372,\"caption\":\"how to install and configure fail2ban on ubuntu 20.04\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/how-to-install-and-configure-fail2ban-on-ubuntu-20-04\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to Install and Configure Fail2ban on Ubuntu 20.04\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/\",\"name\":\"RoseHosting.com\",\"description\":\"Premium Linux Tutorials Since 2001\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/#organization\",\"name\":\"RoseHosting\",\"url\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/03\\\/android-chrome-192x192-1.png\",\"contentUrl\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/03\\\/android-chrome-192x192-1.png\",\"width\":192,\"height\":192,\"caption\":\"RoseHosting\"},\"image\":{\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/RoseHosting\",\"https:\\\/\\\/x.com\\\/rosehosting\",\"https:\\\/\\\/www.linkedin.com\\\/in\\\/rosehosting\\\/\"],\"description\":\"RoseHosting is a leading Linux hosting provider, serving thousands of clients world-wide since 2001.\",\"email\":\"info@rosehosting.com\",\"telephone\":\"(314) 275-0414\",\"legalName\":\"Rose Web Services LLC\",\"foundingDate\":\"2001-04-02\",\"numberOfEmployees\":{\"@type\":\"QuantitativeValue\",\"minValue\":\"11\",\"maxValue\":\"50\"}},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/#\\\/schema\\\/person\\\/7ce77a842fa6a9a7f8efa186f2353713\",\"name\":\"Jeff Wilson\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/0985fed6af04cc60703d2ecf27c65dfa373e0ca00eb21c0b03477e099ea3f99f?s=96&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/0985fed6af04cc60703d2ecf27c65dfa373e0ca00eb21c0b03477e099ea3f99f?s=96&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/0985fed6af04cc60703d2ecf27c65dfa373e0ca00eb21c0b03477e099ea3f99f?s=96&r=g\",\"caption\":\"Jeff Wilson\"},\"description\":\"An experienced Linux veteran with many years of experience. Helping other Linux admins with frequent Linux and business-related blog posts on the RoseHosting blog. Techie by choice. Loving nature and travel. Happily married and father of two lovely children.\",\"sameAs\":[\"https:\\\/\\\/www.rosehosting.com\",\"https:\\\/\\\/www.facebook.com\\\/rosehosting.helpdesk\"],\"url\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/author\\\/jwilson\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"How To Install and Configure Fail2Ban on Ubuntu 20.04 | RoseHosting","description":"Learn how to install and configure Fail2Ban on Ubuntu 20.04. Fail2Ban is a framework that protects computer servers from attacks.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.rosehosting.com\/blog\/how-to-install-and-configure-fail2ban-on-ubuntu-20-04\/","og_locale":"en_US","og_type":"article","og_title":"How To Install and Configure Fail2Ban on Ubuntu 20.04 | RoseHosting","og_description":"Learn how to install and configure Fail2Ban on Ubuntu 20.04. Fail2Ban is a framework that protects computer servers from attacks.","og_url":"https:\/\/www.rosehosting.com\/blog\/how-to-install-and-configure-fail2ban-on-ubuntu-20-04\/","og_site_name":"RoseHosting","article_publisher":"https:\/\/www.facebook.com\/RoseHosting","article_author":"https:\/\/www.facebook.com\/rosehosting.helpdesk","article_published_time":"2021-10-18T17:30:00+00:00","article_modified_time":"2022-06-03T08:31:31+00:00","og_image":[{"width":742,"height":372,"url":"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2021\/10\/how-to-install-and-configure-fail2ban-on-ubuntu-20.04.jpg?v=1633941388","type":"image\/jpeg"}],"author":"Jeff Wilson","twitter_card":"summary_large_image","twitter_title":"How To Install and Configure Fail2Ban on Ubuntu 20.04 | RoseHosting","twitter_description":"Learn how to install and configure Fail2Ban on Ubuntu 20.04. Fail2Ban is a framework that protects computer servers from attacks.","twitter_creator":"@rosehosting","twitter_site":"@rosehosting","twitter_misc":{"Written by":"Jeff Wilson","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.rosehosting.com\/blog\/how-to-install-and-configure-fail2ban-on-ubuntu-20-04\/#article","isPartOf":{"@id":"https:\/\/www.rosehosting.com\/blog\/how-to-install-and-configure-fail2ban-on-ubuntu-20-04\/"},"author":{"name":"Jeff Wilson","@id":"https:\/\/www.rosehosting.com\/blog\/#\/schema\/person\/7ce77a842fa6a9a7f8efa186f2353713"},"headline":"How to Install and Configure Fail2ban on Ubuntu 20.04","datePublished":"2021-10-18T17:30:00+00:00","dateModified":"2022-06-03T08:31:31+00:00","mainEntityOfPage":{"@id":"https:\/\/www.rosehosting.com\/blog\/how-to-install-and-configure-fail2ban-on-ubuntu-20-04\/"},"wordCount":754,"commentCount":0,"publisher":{"@id":"https:\/\/www.rosehosting.com\/blog\/#organization"},"image":{"@id":"https:\/\/www.rosehosting.com\/blog\/how-to-install-and-configure-fail2ban-on-ubuntu-20-04\/#primaryimage"},"thumbnailUrl":"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2021\/10\/how-to-install-and-configure-fail2ban-on-ubuntu-20.04.jpg","keywords":["fail2ban","how to install","Ubuntu 20.04"],"articleSection":["Tutorials","Ubuntu"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.rosehosting.com\/blog\/how-to-install-and-configure-fail2ban-on-ubuntu-20-04\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.rosehosting.com\/blog\/how-to-install-and-configure-fail2ban-on-ubuntu-20-04\/","url":"https:\/\/www.rosehosting.com\/blog\/how-to-install-and-configure-fail2ban-on-ubuntu-20-04\/","name":"How To Install and Configure Fail2Ban on Ubuntu 20.04 | RoseHosting","isPartOf":{"@id":"https:\/\/www.rosehosting.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.rosehosting.com\/blog\/how-to-install-and-configure-fail2ban-on-ubuntu-20-04\/#primaryimage"},"image":{"@id":"https:\/\/www.rosehosting.com\/blog\/how-to-install-and-configure-fail2ban-on-ubuntu-20-04\/#primaryimage"},"thumbnailUrl":"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2021\/10\/how-to-install-and-configure-fail2ban-on-ubuntu-20.04.jpg","datePublished":"2021-10-18T17:30:00+00:00","dateModified":"2022-06-03T08:31:31+00:00","description":"Learn how to install and configure Fail2Ban on Ubuntu 20.04. Fail2Ban is a framework that protects computer servers from attacks.","breadcrumb":{"@id":"https:\/\/www.rosehosting.com\/blog\/how-to-install-and-configure-fail2ban-on-ubuntu-20-04\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.rosehosting.com\/blog\/how-to-install-and-configure-fail2ban-on-ubuntu-20-04\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.rosehosting.com\/blog\/how-to-install-and-configure-fail2ban-on-ubuntu-20-04\/#primaryimage","url":"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2021\/10\/how-to-install-and-configure-fail2ban-on-ubuntu-20.04.jpg","contentUrl":"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2021\/10\/how-to-install-and-configure-fail2ban-on-ubuntu-20.04.jpg","width":742,"height":372,"caption":"how to install and configure fail2ban on ubuntu 20.04"},{"@type":"BreadcrumbList","@id":"https:\/\/www.rosehosting.com\/blog\/how-to-install-and-configure-fail2ban-on-ubuntu-20-04\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.rosehosting.com\/blog\/"},{"@type":"ListItem","position":2,"name":"How to Install and Configure Fail2ban on Ubuntu 20.04"}]},{"@type":"WebSite","@id":"https:\/\/www.rosehosting.com\/blog\/#website","url":"https:\/\/www.rosehosting.com\/blog\/","name":"RoseHosting.com","description":"Premium Linux Tutorials Since 2001","publisher":{"@id":"https:\/\/www.rosehosting.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.rosehosting.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.rosehosting.com\/blog\/#organization","name":"RoseHosting","url":"https:\/\/www.rosehosting.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.rosehosting.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2022\/03\/android-chrome-192x192-1.png","contentUrl":"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2022\/03\/android-chrome-192x192-1.png","width":192,"height":192,"caption":"RoseHosting"},"image":{"@id":"https:\/\/www.rosehosting.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/RoseHosting","https:\/\/x.com\/rosehosting","https:\/\/www.linkedin.com\/in\/rosehosting\/"],"description":"RoseHosting is a leading Linux hosting provider, serving thousands of clients world-wide since 2001.","email":"info@rosehosting.com","telephone":"(314) 275-0414","legalName":"Rose Web Services LLC","foundingDate":"2001-04-02","numberOfEmployees":{"@type":"QuantitativeValue","minValue":"11","maxValue":"50"}},{"@type":"Person","@id":"https:\/\/www.rosehosting.com\/blog\/#\/schema\/person\/7ce77a842fa6a9a7f8efa186f2353713","name":"Jeff Wilson","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/0985fed6af04cc60703d2ecf27c65dfa373e0ca00eb21c0b03477e099ea3f99f?s=96&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/0985fed6af04cc60703d2ecf27c65dfa373e0ca00eb21c0b03477e099ea3f99f?s=96&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/0985fed6af04cc60703d2ecf27c65dfa373e0ca00eb21c0b03477e099ea3f99f?s=96&r=g","caption":"Jeff Wilson"},"description":"An experienced Linux veteran with many years of experience. Helping other Linux admins with frequent Linux and business-related blog posts on the RoseHosting blog. Techie by choice. Loving nature and travel. Happily married and father of two lovely children.","sameAs":["https:\/\/www.rosehosting.com","https:\/\/www.facebook.com\/rosehosting.helpdesk"],"url":"https:\/\/www.rosehosting.com\/blog\/author\/jwilson\/"}]}},"_links":{"self":[{"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/posts\/39239","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/comments?post=39239"}],"version-history":[{"count":10,"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/posts\/39239\/revisions"}],"predecessor-version":[{"id":39276,"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/posts\/39239\/revisions\/39276"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/media\/39271"}],"wp:attachment":[{"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/media?parent=39239"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/categories?post=39239"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/tags?post=39239"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}