{"id":43315,"date":"2022-12-14T12:30:14","date_gmt":"2022-12-14T18:30:14","guid":{"rendered":"https:\/\/www.rosehosting.com\/blog\/?p=43315"},"modified":"2022-12-28T04:34:31","modified_gmt":"2022-12-28T10:34:31","slug":"how-to-protect-ssh-with-fail2ban-on-ubuntu-22-04","status":"publish","type":"post","link":"https:\/\/www.rosehosting.com\/blog\/how-to-protect-ssh-with-fail2ban-on-ubuntu-22-04\/","title":{"rendered":"How To Protect SSH with Fail2Ban on Ubuntu 22.04"},"content":{"rendered":"<div id=\"bsf_rt_marker\"><\/div><p><img decoding=\"async\" class=\"alignnone size-full wp-image-43635\" src=\"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2022\/11\/how-to-protect-ssh-with-fail2ban-on-ubuntu-22-04.webp\" alt=\"how to protect ssh with fail2ban on ubuntu 22.04\" width=\"742\" height=\"372\" srcset=\"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2022\/11\/how-to-protect-ssh-with-fail2ban-on-ubuntu-22-04.webp 742w, https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2022\/11\/how-to-protect-ssh-with-fail2ban-on-ubuntu-22-04-300x150.webp 300w, https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2022\/11\/how-to-protect-ssh-with-fail2ban-on-ubuntu-22-04-150x75.webp 150w\" sizes=\"(max-width: 742px) 100vw, 742px\" \/><\/p>\n<p>In this tutorial, we are going to show you how to protect SSH with Fail2ban on Ubuntu 22.04<\/p>\n<p>SSH stands for Secure Shell Protocol and is a cryptographic network protocol for operating network services securely over an unsecured network. Fail2ban is an intrusion prevention software framework. Fail2ban is written in Python and is used to prevent brute-force attacks. In the next paragraphs, we are going to install Fail2ban and will provide you with commands for managing the fail2ban service. Then we will proceed with the fail2ban configuration for <a href=\"https:\/\/www.rosehosting.com\/blog\/how-to-download-a-file-from-a-server-to-your-desktop-using-ssh\/\">SSH protection<\/a>.<\/p>\n<p>Installing Fail2ban and protecting SSH is a straightforward process and may take up to 15 minutes. Let&#8217;s get started!<\/p>\n<p><!--more--><\/p>\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_82_2 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-69fd0bf88ef0f\" 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-69fd0bf88ef0f\"  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-protect-ssh-with-fail2ban-on-ubuntu-22-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-protect-ssh-with-fail2ban-on-ubuntu-22-04\/#Step-1-Update-the-System\" >Step 1. Update the System<\/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-protect-ssh-with-fail2ban-on-ubuntu-22-04\/#Step-2-Install-Fail2ban\" >Step 2. Install Fail2ban<\/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-protect-ssh-with-fail2ban-on-ubuntu-22-04\/#Step-3-Configure-Fail2ban\" >Step 3. Configure Fail2ban<\/a><\/li><\/ul><\/nav><\/div>\n<h2><span class=\"ez-toc-section\" id=\"Prerequisites\"><\/span>Prerequisites<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<ul>\n<li>Fresh install of Ubuntu 22.04<\/li>\n<li>User privileges: root or non-root user with sudo privileges<\/li>\n<\/ul>\n<h2><span class=\"ez-toc-section\" id=\"Step-1-Update-the-System\"><\/span>Step 1. Update the System<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>We need to update the system packages to the latest versions available and will proceed with installing fail2ban.<\/p>\n<pre>sudo apt update -y &amp;&amp; sudo apt upgrade -y<\/pre>\n<h2><span class=\"ez-toc-section\" id=\"Step-2-Install-Fail2ban\"><\/span>Step 2. Install Fail2ban<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>To install the Fail2ban service, execute the following command:<\/p>\n<pre>sudo apt install fail2ban -y<\/pre>\n<p>Once installed, start and enable the service:<\/p>\n<pre>sudo systemctl enable fail2ban &amp;&amp; sudo systemctl start fail2ban<\/pre>\n<p>To check if the service is up and running, execute the following command:<\/p>\n<pre>sudo systemctl status fail2ban<\/pre>\n<p>You should receive the following output:<\/p>\n<pre>root@host:~# sudo systemctl status fail2ban\r\n\u25cf fail2ban.service - Fail2Ban Service\r\n     Loaded: loaded (\/lib\/systemd\/system\/fail2ban.service; enabled; vendor preset: enabled)\r\n     Active: active (running) since Tue 2022-10-04 18:14:04 CDT; 4s ago\r\n       Docs: man:fail2ban(1)\r\n   Main PID: 147319 (fail2ban-server)\r\n      Tasks: 5 (limit: 4575)\r\n     Memory: 11.6M\r\n        CPU: 338ms\r\n     CGroup: \/system.slice\/fail2ban.service\r\n             \u2514\u2500147319 \/usr\/bin\/python3 \/usr\/bin\/fail2ban-server -xf start\r\n\r\nOct 04 18:14:04 host.test.vps systemd[1]: Started Fail2Ban Service.\r\nOct 04 18:14:04 host.test.vps fail2ban-server[147319]: Server ready<\/pre>\n<h2><span class=\"ez-toc-section\" id=\"Step-3-Configure-Fail2ban\"><\/span>Step 3. Configure Fail2ban<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Fail2ban configuration files are stored in <b>\/etc\/fail2ban\/<\/b> directory on the server.<\/p>\n<pre>root@host:\/etc\/fail2ban# ll\r\ntotal 80\r\ndrwxr-xr-x   6 root root  4096 Oct  4 18:13 .\/\r\ndrwxr-xr-x 103 root root 12288 Oct  4 18:13 ..\/\r\ndrwxr-xr-x   2 root root  4096 Oct  4 18:13 action.d\/\r\n-rw-r--r--   1 root root  2816 Nov 23  2020 fail2ban.conf\r\ndrwxr-xr-x   2 root root  4096 Mar 10  2022 fail2ban.d\/\r\ndrwxr-xr-x   3 root root  4096 Oct  4 18:13 filter.d\/\r\n-rw-r--r--   1 root root 25071 Mar 10  2022 jail.conf\r\ndrwxr-xr-x   2 root root  4096 Oct  4 18:13 jail.d\/\r\n-rw-r--r--   1 root root   645 Nov 23  2020 paths-arch.conf\r\n-rw-r--r--   1 root root  2827 Nov 23  2020 paths-common.conf\r\n-rw-r--r--   1 root root   650 Mar 10  2022 paths-debian.conf\r\n-rw-r--r--   1 root root   738 Nov 23  2020 paths-opensuse.conf\r\n<\/pre>\n<p>All configuration settings are stored in the <b>jail.conf<\/b> file but in most cases, you should not modify this file but provide customizations in jail.local file, or separate .conf files under <b>jail.d\/<\/b> directory. Modifying this file may result in overwriting the values on the next system update. That is why we are going to make a copy of the original <b>jail.conf<\/b> with the new name <b>jail.local<\/b> as described in the previous sentence.<\/p>\n<pre>cp jail.conf jail.local<\/pre>\n<p>Now we are ready to do some modifications in order to protect SSH.<\/p>\n<p>If you want to apply some rule for all of the services supported by Fail2ban, you need to make changes under the <b>[DEFAULT]<\/b> section near the top of the file. For example, the ban time is set to 10 minutes by default, but you can increase that value, for example, to 60 minutes.<\/p>\n<pre>bantime  = 60m\r\n<\/pre>\n<p>Other important parameters are <b>findtime<\/b> and <b>maxretry<\/b> that always work together. Let&#8217;s set maxretry to 3 and findtime to 5 minutes:<\/p>\n<pre>findtime = 5m\r\nmaxretry = 3<\/pre>\n<p>This means that the client will be banned if there are 3 failed attempts to log in to the server in 5 minutes.<\/p>\n<p>The next parameters that are often used are the email parameters. These parameters will help us to receive an email alert when fail2ban takes action and banning users. This is an explanation of the <b>destemail, sender<\/b> and <b>mta<\/b>.<\/p>\n<pre># Destination email address used solely for the interpolations in\r\n# jail.{conf,local,d\/*} configuration files.\r\n<b>destemail = root@localhost<\/b>\r\n\r\n# Sender email address used solely for some actions\r\n<b>sender = root@fq-hostname<\/b>\r\n\r\n# E-mail action. Since 0.8.1 Fail2Ban uses sendmail MTA for the\r\n# mailing. Change mta configuration parameter to mail if you want to\r\n# revert to conventional 'mail'.\r\n<b>mta = sendmail<\/b>\r\n<\/pre>\n<p>The ban messages are sent to <b>destemail<\/b>, the <b>sender<\/b> is the FROM field in the email, and <b>mta<\/b> is the mail service. By default, the mail service for fail2ban is sendmail, but you can configure any mail service you want. It will work.<\/p>\n<p>Now, let&#8217;s test the Fail2ban configuration about the previous changes.<\/p>\n<pre>ssh user@192.168.0.1\r\nuser@192.168.0.1's password:\r\nPermission denied, please try again.\r\nuser@192.168.0.1's password:\r\nPermission denied, please try again.\r\nuser@192.168.0.1's password:\r\nuser@192.168.0.1: Permission denied (publickey,password).\r\nssh user@92.168.0.1\r\nssh: connect to host 192.168.1.107 port 22: Connection refused<\/pre>\n<p>As you can see, after three failed login attempts, Fail2ban closed the SSH connection. The user will be banned for 5 minutes. If you try to login in that 5 minutes, then the connection will be refused as described above.<\/p>\n<p>If you want to learn more about every parameter in jail.conf file, just execute the following command:<\/p>\n<pre>man jail.conf<\/pre>\n<p>You should receive the following output:<\/p>\n<pre>JAIL.CONF(5)                                                           Fail2Ban Configuration                                                          JAIL.CONF(5)\r\n\r\nNAME\r\n       jail.conf - configuration for the fail2ban server\r\n\r\nSYNOPSIS\r\n       fail2ban.conf fail2ban.d\/*.conf fail2ban.local fail2ban.d\/*.local\r\n\r\n       jail.conf jail.d\/*.conf jail.local jail.d\/*.local\r\n\r\n       action.d\/*.conf action.d\/*.local action.d\/*.py\r\n\r\n       filter.d\/*.conf filter.d\/*.local\r\n\r\nDESCRIPTION\r\n       Fail2ban has four configuration file types:\r\n\r\n       fail2ban.conf\r\n              Fail2Ban global configuration (such as logging)\r\n\r\n       filter.d\/*.conf\r\n              Filters specifying how to detect authentication failures\r\n\r\n       action.d\/*.conf\r\n              Actions defining the commands for banning and unbanning of IP address\r\n\r\n       jail.conf\r\n              Jails defining combinations of Filters with Actions.\r\n\r\n<\/pre>\n<p>That&#8217;s it. You successfully protect SSH with Fail2Ban on Ubuntu 22.04. Of course, you do not have to do this on your own. You just need to sign up for one of our NVMe VPS plans and submit a support ticket. We are available 24\/7<\/p>\n<p>If you liked this about how to protect <a href=\"https:\/\/www.rosehosting.com\/ubuntu-hosting\/\">SSH with Fail2Ban on Ubuntu 22.04<\/a>, please share it with your friends on social networks or simply leave a reply below.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this tutorial, we are going to show you how to protect SSH with Fail2ban on Ubuntu 22.04 SSH stands &#8230; <\/p>\n<p class=\"read-more-container\"><a title=\"How To Protect SSH with Fail2Ban on Ubuntu 22.04\" class=\"read-more button\" href=\"https:\/\/www.rosehosting.com\/blog\/how-to-protect-ssh-with-fail2ban-on-ubuntu-22-04\/#more-43315\" aria-label=\"Read more about How To Protect SSH with Fail2Ban on Ubuntu 22.04\">Read More<\/a><\/p>\n","protected":false},"author":4,"featured_media":43635,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1703,13,1698],"tags":[280,68,59],"class_list":["post-43315","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-security","category-tutorials","category-ubuntu","tag-fail2ban","tag-ssh","tag-ubuntu","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.5 (Yoast SEO v27.5) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>How To Protect SSH with Fail2Ban on Ubuntu 22.04 | RoseHosting<\/title>\n<meta name=\"description\" content=\"In this tutorial, we are going to show you how to protect SSH with Fail2ban on Ubuntu 22.04. Find out more.\" \/>\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-protect-ssh-with-fail2ban-on-ubuntu-22-04\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How To Protect SSH with Fail2Ban on Ubuntu 22.04\" \/>\n<meta property=\"og:description\" content=\"In this tutorial, we are going to show you how to protect SSH with Fail2ban on Ubuntu 22.04. Find out more.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.rosehosting.com\/blog\/how-to-protect-ssh-with-fail2ban-on-ubuntu-22-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=\"2022-12-14T18:30:14+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-12-28T10:34:31+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2022\/11\/how-to-protect-ssh-with-fail2ban-on-ubuntu-22-04.webp\" \/>\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\/webp\" \/>\n<meta name=\"author\" content=\"Jeff Wilson\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:title\" content=\"How To Protect SSH with Fail2Ban on Ubuntu 22.04\" \/>\n<meta name=\"twitter:description\" content=\"In this tutorial, we are going to show you how to protect SSH with Fail2ban on Ubuntu 22.04. Find out more.\" \/>\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-protect-ssh-with-fail2ban-on-ubuntu-22-04\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/how-to-protect-ssh-with-fail2ban-on-ubuntu-22-04\\\/\"},\"author\":{\"name\":\"Jeff Wilson\",\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/#\\\/schema\\\/person\\\/7ce77a842fa6a9a7f8efa186f2353713\"},\"headline\":\"How To Protect SSH with Fail2Ban on Ubuntu 22.04\",\"datePublished\":\"2022-12-14T18:30:14+00:00\",\"dateModified\":\"2022-12-28T10:34:31+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/how-to-protect-ssh-with-fail2ban-on-ubuntu-22-04\\\/\"},\"wordCount\":633,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/how-to-protect-ssh-with-fail2ban-on-ubuntu-22-04\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/11\\\/how-to-protect-ssh-with-fail2ban-on-ubuntu-22-04.webp\",\"keywords\":[\"fail2ban\",\"ssh\",\"ubuntu\"],\"articleSection\":[\"Security\",\"Tutorials\",\"Ubuntu\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/how-to-protect-ssh-with-fail2ban-on-ubuntu-22-04\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/how-to-protect-ssh-with-fail2ban-on-ubuntu-22-04\\\/\",\"url\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/how-to-protect-ssh-with-fail2ban-on-ubuntu-22-04\\\/\",\"name\":\"How To Protect SSH with Fail2Ban on Ubuntu 22.04 | RoseHosting\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/how-to-protect-ssh-with-fail2ban-on-ubuntu-22-04\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/how-to-protect-ssh-with-fail2ban-on-ubuntu-22-04\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/11\\\/how-to-protect-ssh-with-fail2ban-on-ubuntu-22-04.webp\",\"datePublished\":\"2022-12-14T18:30:14+00:00\",\"dateModified\":\"2022-12-28T10:34:31+00:00\",\"description\":\"In this tutorial, we are going to show you how to protect SSH with Fail2ban on Ubuntu 22.04. Find out more.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/how-to-protect-ssh-with-fail2ban-on-ubuntu-22-04\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/how-to-protect-ssh-with-fail2ban-on-ubuntu-22-04\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/how-to-protect-ssh-with-fail2ban-on-ubuntu-22-04\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/11\\\/how-to-protect-ssh-with-fail2ban-on-ubuntu-22-04.webp\",\"contentUrl\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/11\\\/how-to-protect-ssh-with-fail2ban-on-ubuntu-22-04.webp\",\"width\":742,\"height\":372,\"caption\":\"how to protect ssh with fail2ban on ubuntu 22.04\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/how-to-protect-ssh-with-fail2ban-on-ubuntu-22-04\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How To Protect SSH with Fail2Ban on Ubuntu 22.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 Protect SSH with Fail2Ban on Ubuntu 22.04 | RoseHosting","description":"In this tutorial, we are going to show you how to protect SSH with Fail2ban on Ubuntu 22.04. Find out more.","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-protect-ssh-with-fail2ban-on-ubuntu-22-04\/","og_locale":"en_US","og_type":"article","og_title":"How To Protect SSH with Fail2Ban on Ubuntu 22.04","og_description":"In this tutorial, we are going to show you how to protect SSH with Fail2ban on Ubuntu 22.04. Find out more.","og_url":"https:\/\/www.rosehosting.com\/blog\/how-to-protect-ssh-with-fail2ban-on-ubuntu-22-04\/","og_site_name":"RoseHosting","article_publisher":"https:\/\/www.facebook.com\/RoseHosting","article_author":"https:\/\/www.facebook.com\/rosehosting.helpdesk","article_published_time":"2022-12-14T18:30:14+00:00","article_modified_time":"2022-12-28T10:34:31+00:00","og_image":[{"width":742,"height":372,"url":"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2022\/11\/how-to-protect-ssh-with-fail2ban-on-ubuntu-22-04.webp","type":"image\/webp"}],"author":"Jeff Wilson","twitter_card":"summary_large_image","twitter_title":"How To Protect SSH with Fail2Ban on Ubuntu 22.04","twitter_description":"In this tutorial, we are going to show you how to protect SSH with Fail2ban on Ubuntu 22.04. Find out more.","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-protect-ssh-with-fail2ban-on-ubuntu-22-04\/#article","isPartOf":{"@id":"https:\/\/www.rosehosting.com\/blog\/how-to-protect-ssh-with-fail2ban-on-ubuntu-22-04\/"},"author":{"name":"Jeff Wilson","@id":"https:\/\/www.rosehosting.com\/blog\/#\/schema\/person\/7ce77a842fa6a9a7f8efa186f2353713"},"headline":"How To Protect SSH with Fail2Ban on Ubuntu 22.04","datePublished":"2022-12-14T18:30:14+00:00","dateModified":"2022-12-28T10:34:31+00:00","mainEntityOfPage":{"@id":"https:\/\/www.rosehosting.com\/blog\/how-to-protect-ssh-with-fail2ban-on-ubuntu-22-04\/"},"wordCount":633,"commentCount":0,"publisher":{"@id":"https:\/\/www.rosehosting.com\/blog\/#organization"},"image":{"@id":"https:\/\/www.rosehosting.com\/blog\/how-to-protect-ssh-with-fail2ban-on-ubuntu-22-04\/#primaryimage"},"thumbnailUrl":"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2022\/11\/how-to-protect-ssh-with-fail2ban-on-ubuntu-22-04.webp","keywords":["fail2ban","ssh","ubuntu"],"articleSection":["Security","Tutorials","Ubuntu"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.rosehosting.com\/blog\/how-to-protect-ssh-with-fail2ban-on-ubuntu-22-04\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.rosehosting.com\/blog\/how-to-protect-ssh-with-fail2ban-on-ubuntu-22-04\/","url":"https:\/\/www.rosehosting.com\/blog\/how-to-protect-ssh-with-fail2ban-on-ubuntu-22-04\/","name":"How To Protect SSH with Fail2Ban on Ubuntu 22.04 | RoseHosting","isPartOf":{"@id":"https:\/\/www.rosehosting.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.rosehosting.com\/blog\/how-to-protect-ssh-with-fail2ban-on-ubuntu-22-04\/#primaryimage"},"image":{"@id":"https:\/\/www.rosehosting.com\/blog\/how-to-protect-ssh-with-fail2ban-on-ubuntu-22-04\/#primaryimage"},"thumbnailUrl":"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2022\/11\/how-to-protect-ssh-with-fail2ban-on-ubuntu-22-04.webp","datePublished":"2022-12-14T18:30:14+00:00","dateModified":"2022-12-28T10:34:31+00:00","description":"In this tutorial, we are going to show you how to protect SSH with Fail2ban on Ubuntu 22.04. Find out more.","breadcrumb":{"@id":"https:\/\/www.rosehosting.com\/blog\/how-to-protect-ssh-with-fail2ban-on-ubuntu-22-04\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.rosehosting.com\/blog\/how-to-protect-ssh-with-fail2ban-on-ubuntu-22-04\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.rosehosting.com\/blog\/how-to-protect-ssh-with-fail2ban-on-ubuntu-22-04\/#primaryimage","url":"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2022\/11\/how-to-protect-ssh-with-fail2ban-on-ubuntu-22-04.webp","contentUrl":"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2022\/11\/how-to-protect-ssh-with-fail2ban-on-ubuntu-22-04.webp","width":742,"height":372,"caption":"how to protect ssh with fail2ban on ubuntu 22.04"},{"@type":"BreadcrumbList","@id":"https:\/\/www.rosehosting.com\/blog\/how-to-protect-ssh-with-fail2ban-on-ubuntu-22-04\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.rosehosting.com\/blog\/"},{"@type":"ListItem","position":2,"name":"How To Protect SSH with Fail2Ban on Ubuntu 22.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\/43315","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=43315"}],"version-history":[{"count":5,"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/posts\/43315\/revisions"}],"predecessor-version":[{"id":43653,"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/posts\/43315\/revisions\/43653"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/media\/43635"}],"wp:attachment":[{"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/media?parent=43315"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/categories?post=43315"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/tags?post=43315"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}