{"id":20115,"date":"2026-05-15T15:39:18","date_gmt":"2026-05-15T12:39:18","guid":{"rendered":"https:\/\/unihost.com\/help\/?p=20115"},"modified":"2026-05-15T15:39:18","modified_gmt":"2026-05-15T12:39:18","slug":"protect-ssh-from-brute-force","status":"publish","type":"post","link":"https:\/\/unihost.com\/help\/protect-ssh-from-brute-force\/","title":{"rendered":"How to Protect SSH from Brute Force Attacks: 5 Main Solutions"},"content":{"rendered":"<p data-start=\"79\" data-end=\"281\"><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\">SSH is the main way to remotely manage a Linux server. Through SSH, an administrator connects to a VPS or dedicated server, performs configuration, updates the system, checks logs, and manages services.<\/span><\/p>\n<p data-start=\"283\" data-end=\"540\"><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\">Because of this, SSH almost always becomes one of the first targets for automated attacks. Bots scan the internet, find an open port 22, and start trying different usernames and passwords. This type of attack is called <strong data-start=\"504\" data-end=\"519\">brute force<\/strong> \u2014 password guessing.<\/span><\/p>\n<p data-start=\"542\" data-end=\"798\"><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\">Even if the password is strong, constant login attempts create unnecessary load, fill up logs, and increase the risk of server compromise. If a weak password, the standard root login, and an open SSH port are used, the server can be hacked automatically.<\/span><\/p>\n<p data-start=\"800\" data-end=\"840\"><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\">Usually, such an attack looks like this:<\/span><\/p>\n<pre><span style=\"font-weight: 400; font-family: Ubuntu, sans-serif; font-size: 12pt;\">Failed password for root from 185.XX.XX.XX port 54321 ssh2<\/span><br \/><span style=\"font-weight: 400; font-family: Ubuntu, sans-serif; font-size: 12pt;\">Failed password for admin from 185.XX.XX.XX port 54322 ssh2<\/span><br \/><span style=\"font-weight: 400; font-family: Ubuntu, sans-serif; font-size: 12pt;\">Failed password for test from 185.XX.XX.XX port 54323 ssh2<\/span><\/pre>\n<p><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\">In this article, we will look at 5 main solutions that help protect SSH from brute force attacks.<\/span><\/p>\n<h2><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\"><b>1. Use SSH Keys and Disable Password Login<\/b><\/span><\/h2>\n<p data-start=\"1179\" data-end=\"1431\"><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\">The most important step is to stop using password login and switch to SSH keys. A password can be guessed, especially if it is simple or has already been compromised. An SSH key is almost impossible to brute force if the private key is stored securely.<\/span><\/p>\n<p data-start=\"1433\" data-end=\"1474\"><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\">Create an SSH key on your local computer:<\/span><\/p>\n<p><span style=\"font-weight: 400; font-family: Ubuntu, sans-serif; font-size: 12pt;\">ssh-keygen -t ed25519 -C &#8220;admin@example.com&#8221;<\/span><\/p>\n<p><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\">Add the public key to the server:<\/span><\/p>\n<p><span style=\"font-weight: 400; font-family: Ubuntu, sans-serif; font-size: 12pt;\">ssh-copy-id user@SERVER_IP<\/span><\/p>\n<p><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\">Or manually add the public key content to the file:<\/span><\/p>\n<pre><span style=\"font-weight: 400; font-family: Ubuntu, sans-serif; font-size: 12pt;\">~\/.ssh\/authorized_keys<\/span><\/pre>\n<p data-start=\"1698\" data-end=\"1786\"><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\"><strong>Important<\/strong><\/span><br data-start=\"1707\" data-end=\"1710\" \/><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\">Before disabling password login, make sure that SSH key login already works.<\/span><\/p>\n<p data-start=\"1788\" data-end=\"1825\"><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\">Then open the SSH configuration file:<\/span><\/p>\n<pre><span style=\"font-weight: 400; font-family: Ubuntu, sans-serif; font-size: 12pt;\">sudo nano \/etc\/ssh\/sshd_config<\/span><\/pre>\n<p><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\">Specify:<\/span><\/p>\n<pre><span style=\"font-weight: 400; font-family: Ubuntu, sans-serif; font-size: 12pt;\">PubkeyAuthentication yes<\/span><br \/><span style=\"font-weight: 400; font-family: Ubuntu, sans-serif; font-size: 12pt;\">PasswordAuthentication no<\/span><br \/><span style=\"font-weight: 400; font-family: Ubuntu, sans-serif; font-size: 12pt;\">KbdInteractiveAuthentication no<\/span><\/pre>\n<p><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\">Check the configuration:<\/span><\/p>\n<pre><span style=\"font-weight: 400; font-family: Ubuntu, sans-serif; font-size: 12pt;\">sudo sshd -t<\/span><\/pre>\n<p><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\">If there are no errors, reload SSH:<\/span><\/p>\n<pre><span style=\"font-weight: 400; font-family: Ubuntu, sans-serif; font-size: 12pt;\">sudo systemctl reload ssh<\/span><\/pre>\n<p><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\">or:<\/span><\/p>\n<pre><span style=\"font-weight: 400; font-family: Ubuntu, sans-serif; font-size: 12pt;\">sudo systemctl reload sshd<\/span><\/pre>\n<p data-start=\"2150\" data-end=\"2195\"><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\">The service name depends on the distribution.<\/span><\/p>\n<p data-start=\"2197\" data-end=\"2278\"><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\">Do not close your current SSH session until you test login in a new terminal tab.<\/span><\/p>\n<h2><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\"><b>2. Disable root Login<\/b><\/span><\/h2>\n<p data-start=\"2306\" data-end=\"2527\"><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\">Many brute force attacks first try the root login because it exists on almost every Linux server. Therefore, it is better to disable SSH login as root and use a separate user with sudo privileges for administration.<\/span><\/p>\n<p data-start=\"2529\" data-end=\"2552\"><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\">Create a separate user:<\/span><\/p>\n<pre><span style=\"font-weight: 400; font-family: Ubuntu, sans-serif; font-size: 12pt;\">sudo adduser adminuser<\/span><br \/><span style=\"font-weight: 400; font-family: Ubuntu, sans-serif; font-size: 12pt;\">sudo usermod -aG sudo adminuser<\/span><\/pre>\n<p><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\">Check login as this user:<\/span><\/p>\n<pre><span style=\"font-weight: 400; font-family: Ubuntu, sans-serif; font-size: 12pt;\">ssh adminuser@SERVER_IP<\/span><\/pre>\n<p><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\">Check sudo privileges:<\/span><\/p>\n<pre><span style=\"font-weight: 400; font-family: Ubuntu, sans-serif; font-size: 12pt;\">sudo whoami<\/span><\/pre>\n<p><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\">Expected response:<\/span><\/p>\n<pre><span style=\"font-weight: 400; font-family: Ubuntu, sans-serif; font-size: 12pt;\">root<\/span><\/pre>\n<p><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\">After that, specify the following in the SSH configuration:<\/span><\/p>\n<pre><span style=\"font-weight: 400; font-family: Ubuntu, sans-serif; font-size: 12pt;\">PermitRootLogin no<\/span><\/pre>\n<p><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\">Apply the changes:<\/span><\/p>\n<pre><span style=\"font-weight: 400; font-family: Ubuntu, sans-serif; font-size: 12pt;\">sudo sshd -t<\/span><br \/><span style=\"font-weight: 400; font-family: Ubuntu, sans-serif; font-size: 12pt;\">sudo systemctl reload ssh<\/span><\/pre>\n<p><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\">This approach reduces the risk of automated access attempts because the attacker needs to know not only the key, but also the separate username.<\/span><\/p>\n<h2><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\"><b>3. Limit the Number of Login Attempts<\/b><\/span><\/h2>\n<p data-start=\"3128\" data-end=\"3319\"><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\">Even if password login is disabled, it is useful to limit the number of authentication attempts. This helps terminate suspicious connections faster and reduce the load from automated attacks.<\/span><\/p>\n<p data-start=\"3321\" data-end=\"3353\"><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\">Open the SSH configuration file:<\/span><\/p>\n<pre><span style=\"font-weight: 400; font-family: Ubuntu, sans-serif; font-size: 12pt;\">sudo nano \/etc\/ssh\/sshd_config<\/span><\/pre>\n<p><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\">Add or change the parameters:<\/span><\/p>\n<pre><span style=\"font-weight: 400; font-family: Ubuntu, sans-serif; font-size: 12pt;\">MaxAuthTries 3<\/span><br \/><span style=\"font-weight: 400; font-family: Ubuntu, sans-serif; font-size: 12pt;\">LoginGraceTime 30<\/span><\/pre>\n<p data-start=\"3476\" data-end=\"3492\"><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\">What this means:<\/span><\/p>\n<p><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\"><span style=\"font-weight: 400;\">MaxAuthTries 3 \u00a0 \u00a0 \u2014 no more than 3 authentication attempts per connection<br \/><\/span><span style=\"font-weight: 400;\">LoginGraceTime 30\u00a0 \u2014 30 seconds for a successful login<\/span><\/span><\/p>\n<p><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\">After making changes, check the configuration:<\/span><\/p>\n<pre><span style=\"font-weight: 400; font-family: Ubuntu, sans-serif; font-size: 12pt;\">sudo sshd -t<\/span><\/pre>\n<p><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\">Reload SSH:<\/span><\/p>\n<pre><span style=\"font-weight: 400; font-family: Ubuntu, sans-serif; font-size: 12pt;\">sudo systemctl reload ssh<\/span><\/pre>\n<p><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\">Recommendation<\/span><br data-start=\"3777\" data-end=\"3780\" \/><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\">Do not set the values too low if several administrators connect to the server or automated SSH connections are used.<\/span><\/p>\n<h2><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\"><b>4. Allow SSH Only from Trusted IPs or Through a VPN<\/b><\/span><\/h2>\n<p data-start=\"3954\" data-end=\"4102\"><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\">If SSH is open to the entire internet, it will be constantly scanned by bots. A safer option is to allow connections only from trusted IP addresses.<\/span><\/p>\n<p data-start=\"4104\" data-end=\"4120\"><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\">Example for UFW:<\/span><\/p>\n<pre><span style=\"font-weight: 400; font-family: Ubuntu, sans-serif; font-size: 12pt;\">sudo ufw allow from YOUR_TRUSTED_IP to any port 22 proto tcp<\/span><br \/><span style=\"font-weight: 400; font-family: Ubuntu, sans-serif; font-size: 12pt;\">sudo ufw deny 22\/tcp<\/span><br \/><span style=\"font-weight: 400; font-family: Ubuntu, sans-serif; font-size: 12pt;\">sudo ufw enable<\/span><\/pre>\n<p><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\">Check the rules:<\/span><\/p>\n<pre><span style=\"font-weight: 400; font-family: Ubuntu, sans-serif; font-size: 12pt;\">sudo ufw status numbered<\/span><\/pre>\n<p data-start=\"4289\" data-end=\"4303\"><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\">Example logic:<\/span><\/p>\n<p><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\"><span style=\"font-weight: 400;\">Allow SSH from trusted IP<br \/><\/span><span style=\"font-weight: 400;\">Deny SSH from all other IPs<\/span><\/span><\/p>\n<p data-start=\"4372\" data-end=\"4561\"><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\">If administrators do not have fixed IP addresses, it is better to use a VPN. In this case, SSH is not published directly to the internet and is available only from the internal VPN network.<\/span><\/p>\n<p data-start=\"4563\" data-end=\"4708\"><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\">This option is especially suitable for production servers, Proxmox infrastructure, OPNsense, internal services, databases, and corporate systems.<\/span><\/p>\n<h2><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\"><b>5. Install Fail2Ban for Automatic Blocking of Attacking IPs<\/b><\/span><\/h2>\n<p data-start=\"4774\" data-end=\"4989\"><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\">Fail2Ban is one of the most popular tools for protecting SSH from brute force attacks. It analyzes logs, detects repeated failed login attempts, and temporarily blocks the attacker\u2019s IP address through the firewall.<\/span><\/p>\n<p data-start=\"4991\" data-end=\"5019\"><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\">Install it on Debian\/Ubuntu:<\/span><\/p>\n<pre><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\"><span style=\"font-weight: 400;\">sudo apt update<br \/><\/span><span style=\"font-weight: 400;\">sudo apt install fail2ban -y<\/span><\/span><\/pre>\n<p><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\">Create a configuration file for SSH:<\/span><\/p>\n<pre><span style=\"font-weight: 400; font-family: Ubuntu, sans-serif; font-size: 12pt;\">sudo nano \/etc\/fail2ban\/jail.d\/sshd.local<\/span><\/pre>\n<p><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\">Example configuration:<\/span><\/p>\n<pre><span style=\"font-weight: 400; font-family: Ubuntu, sans-serif; font-size: 12pt;\">[sshd]<\/span><br \/><span style=\"font-weight: 400; font-family: Ubuntu, sans-serif; font-size: 12pt;\">enabled = true<\/span><br \/><span style=\"font-weight: 400; font-family: Ubuntu, sans-serif; font-size: 12pt;\">port = ssh<\/span><br \/><span style=\"font-weight: 400; font-family: Ubuntu, sans-serif; font-size: 12pt;\">filter = sshd<\/span><br \/><span style=\"font-weight: 400; font-family: Ubuntu, sans-serif; font-size: 12pt;\">backend = systemd<\/span><br \/><span style=\"font-weight: 400; font-family: Ubuntu, sans-serif; font-size: 12pt;\">maxretry = 5<\/span><br \/><span style=\"font-weight: 400; font-family: Ubuntu, sans-serif; font-size: 12pt;\">findtime = 10m<\/span><br \/><span style=\"font-weight: 400; font-family: Ubuntu, sans-serif; font-size: 12pt;\">bantime = 1h<\/span><\/pre>\n<p><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\">What the parameters mean:<\/span><\/p>\n<p><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\"><span style=\"font-weight: 400;\">maxretry = 5\u00a0 \u00a0 \u2014 block after 5 failed attempts<br \/><\/span><span style=\"font-weight: 400;\">findtime = 10m\u00a0 \u2014 count attempts within the last 10 minutes<br \/><\/span><span style=\"font-weight: 400;\">bantime = 1h\u00a0 \u00a0 \u2014 block the IP for 1 hour<\/span><\/span><\/p>\n<p><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\">Start Fail2Ban:<\/span><\/p>\n<pre><span style=\"font-weight: 400; font-family: Ubuntu, sans-serif; font-size: 12pt;\">sudo systemctl enable --now fail2ban<\/span><br \/><span style=\"font-weight: 400; font-family: Ubuntu, sans-serif; font-size: 12pt;\">sudo systemctl restart fail2ban<\/span><\/pre>\n<p><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\">Check the status:<\/span><\/p>\n<pre><span style=\"font-weight: 400; font-family: Ubuntu, sans-serif; font-size: 12pt;\">sudo fail2ban-client status<\/span><br \/><span style=\"font-weight: 400; font-family: Ubuntu, sans-serif; font-size: 12pt;\">sudo fail2ban-client status sshd<\/span><\/pre>\n<p><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\">If everything works correctly, the status will show the number of blocked IP addresses.<\/span><\/p>\n<p data-start=\"5785\" data-end=\"5836\"><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\"><strong>You can also consider CrowdSec instead of Fail2Ban.<\/strong><\/span><\/p>\n<p data-start=\"5838\" data-end=\"6025\"><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\">With a standard installation, CrowdSec usually adds basic Linux\/SSH collections, and after installing a firewall bouncer, it can block IP addresses that trigger SSH brute force scenarios.<\/span><\/p>\n<p data-start=\"6027\" data-end=\"6169\"><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\">In other words, the CrowdSec + bouncer setup not only detects suspicious SSH attempts in logs, but also applies blocking through the firewall.<\/span><\/p>\n<p data-start=\"6171\" data-end=\"6278\"><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\">CrowdSec can also be extended to protect other services: Nginx, Apache, Traefik, Docker, or control panels.<\/span><\/p>\n<p data-start=\"6280\" data-end=\"6409\"><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\">Important: the CrowdSec engine is responsible for detection, while the bouncer is responsible for actually blocking IP addresses.<\/span><\/p>\n<h3 data-section-id=\"8dtpi\" data-start=\"6411\" data-end=\"6424\"><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\">Conclusion<\/span><\/h3>\n<p data-start=\"6426\" data-end=\"6566\"><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\">SSH protection against brute force attacks should not be limited to a single setting. The best result comes from combining several measures:<\/span><\/p>\n<ul>\n<li><span style=\"font-weight: 400; font-family: Ubuntu, sans-serif; font-size: 12pt;\">SSH keys<\/span><\/li>\n<li><span style=\"font-weight: 400; font-family: Ubuntu, sans-serif; font-size: 12pt;\">No password login<\/span><\/li>\n<li><span style=\"font-weight: 400; font-family: Ubuntu, sans-serif; font-size: 12pt;\">No root login<\/span><\/li>\n<li><span style=\"font-weight: 400; font-family: Ubuntu, sans-serif; font-size: 12pt;\">Limited login attempts<\/span><\/li>\n<li><span style=\"font-weight: 400; font-family: Ubuntu, sans-serif; font-size: 12pt;\">Firewall allowlist or VPN<\/span><\/li>\n<li><span style=\"font-weight: 400; font-family: Ubuntu, sans-serif; font-size: 12pt;\">Fail2Ban<\/span><\/li>\n<\/ul>\n<p data-start=\"6680\" data-end=\"6959\"><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\">For a test VPS, SSH keys, disabled password login, and Fail2Ban are often enough. For a production server, it is better to use a stricter approach: close SSH from the entire internet, allow access only from trusted IPs or through a VPN, and regularly check the protection status.<\/span><\/p>\n<p data-start=\"6961\" data-end=\"7074\" data-is-last-node=\"\" data-is-only-node=\"\"><span style=\"font-family: Ubuntu, sans-serif; font-size: 12pt;\">This approach significantly reduces the risk of hacking and makes the server more resistant to automated attacks.<\/span><\/p>\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>SSH is the main way to remotely manage a Linux server. Through SSH, an administrator connects to a VPS or dedicated server, performs configuration, updates the system, checks logs, and manages services. Because of this, SSH almost always becomes one of the first targets for automated attacks. Bots scan the internet, find an open port [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[811],"class_list":["post-20115","post","type-post","status-publish","format-standard","hentry","tag-ssh-2"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>How to Protect SSH from Brute Force Attacks<\/title>\n<meta name=\"description\" content=\"Learn how to protect SSH from brute force attacks using SSH keys, disabled root login, login attempt limits, firewall rules, VPN access, Fail2Ban, and CrowdSec.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/unihost.com\/help\/protect-ssh-from-brute-force\/\" \/>\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 from Brute Force Attacks\" \/>\n<meta property=\"og:description\" content=\"Learn how to protect SSH from brute force attacks using SSH keys, disabled root login, login attempt limits, firewall rules, VPN access, Fail2Ban, and CrowdSec.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/unihost.com\/help\/protect-ssh-from-brute-force\/\" \/>\n<meta property=\"og:site_name\" content=\"Unihost.FAQ\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/unihost\/\" \/>\n<meta property=\"article:published_time\" content=\"2026-05-15T12:39:18+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/unihost.com\/help\/minio.php?.\/unihost-logo-alt.png\" \/>\n\t<meta property=\"og:image:width\" content=\"250\" \/>\n\t<meta property=\"og:image:height\" content=\"141\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Unihost Support\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@unihost\" \/>\n<meta name=\"twitter:site\" content=\"@unihost\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Unihost Support\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/unihost.com\/help\/protect-ssh-from-brute-force\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/unihost.com\/help\/protect-ssh-from-brute-force\/\"},\"author\":{\"name\":\"Unihost Support\",\"@id\":\"https:\/\/unihost.com\/help\/#\/schema\/person\/bb5ae95f38577c920e6a7507888b715a\"},\"headline\":\"How to Protect SSH from Brute Force Attacks: 5 Main Solutions\",\"datePublished\":\"2026-05-15T12:39:18+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/unihost.com\/help\/protect-ssh-from-brute-force\/\"},\"wordCount\":881,\"publisher\":{\"@id\":\"https:\/\/unihost.com\/help\/#organization\"},\"keywords\":[\"SSH\"],\"inLanguage\":\"en\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/unihost.com\/help\/protect-ssh-from-brute-force\/\",\"url\":\"https:\/\/unihost.com\/help\/protect-ssh-from-brute-force\/\",\"name\":\"How to Protect SSH from Brute Force Attacks\",\"isPartOf\":{\"@id\":\"https:\/\/unihost.com\/help\/#website\"},\"datePublished\":\"2026-05-15T12:39:18+00:00\",\"description\":\"Learn how to protect SSH from brute force attacks using SSH keys, disabled root login, login attempt limits, firewall rules, VPN access, Fail2Ban, and CrowdSec.\",\"breadcrumb\":{\"@id\":\"https:\/\/unihost.com\/help\/protect-ssh-from-brute-force\/#breadcrumb\"},\"inLanguage\":\"en\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/unihost.com\/help\/protect-ssh-from-brute-force\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/unihost.com\/help\/protect-ssh-from-brute-force\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Unihost\",\"item\":\"https:\/\/unihost.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Help\",\"item\":\"https:\/\/unihost.com\/help\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"How to Protect SSH from Brute Force Attacks: 5 Main Solutions\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/unihost.com\/help\/#website\",\"url\":\"https:\/\/unihost.com\/help\/\",\"name\":\"Unihost.FAQ\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/unihost.com\/help\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/unihost.com\/help\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/unihost.com\/help\/#organization\",\"name\":\"Unihost\",\"alternateName\":\"Unihost\",\"url\":\"https:\/\/unihost.com\/help\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en\",\"@id\":\"https:\/\/unihost.com\/help\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/unihost.com\/help\/minio.php?2026\/01\/minio.png\",\"contentUrl\":\"https:\/\/unihost.com\/help\/minio.php?2026\/01\/minio.png\",\"width\":300,\"height\":300,\"caption\":\"Unihost\"},\"image\":{\"@id\":\"https:\/\/unihost.com\/help\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/unihost\/\",\"https:\/\/x.com\/unihost\",\"https:\/\/www.instagram.com\/unihost\/?hl=en\",\"https:\/\/www.linkedin.com\/company\/unihost-com\",\"https:\/\/www.youtube.com\/channel\/UCITKsxMDnslQY8brN3advgw\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/unihost.com\/help\/#\/schema\/person\/bb5ae95f38577c920e6a7507888b715a\",\"name\":\"Unihost Support\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en\",\"@id\":\"https:\/\/unihost.com\/help\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/a0c9db17c2a0d93e8a0d5ac123f8c5db750ad4d3d5657369c0c4e480f5af77b8?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/a0c9db17c2a0d93e8a0d5ac123f8c5db750ad4d3d5657369c0c4e480f5af77b8?s=96&d=mm&r=g\",\"caption\":\"Unihost Support\"},\"sameAs\":[\"https:\/\/unihost.com\/\"],\"url\":\"https:\/\/unihost.com\/help\/author\/support\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to Protect SSH from Brute Force Attacks","description":"Learn how to protect SSH from brute force attacks using SSH keys, disabled root login, login attempt limits, firewall rules, VPN access, Fail2Ban, and CrowdSec.","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:\/\/unihost.com\/help\/protect-ssh-from-brute-force\/","og_locale":"en_US","og_type":"article","og_title":"How to Protect SSH from Brute Force Attacks","og_description":"Learn how to protect SSH from brute force attacks using SSH keys, disabled root login, login attempt limits, firewall rules, VPN access, Fail2Ban, and CrowdSec.","og_url":"https:\/\/unihost.com\/help\/protect-ssh-from-brute-force\/","og_site_name":"Unihost.FAQ","article_publisher":"https:\/\/www.facebook.com\/unihost\/","article_published_time":"2026-05-15T12:39:18+00:00","og_image":[{"width":250,"height":141,"url":"https:\/\/unihost.com\/help\/minio.php?.\/unihost-logo-alt.png","type":"image\/png"}],"author":"Unihost Support","twitter_card":"summary_large_image","twitter_creator":"@unihost","twitter_site":"@unihost","twitter_misc":{"Written by":"Unihost Support","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/unihost.com\/help\/protect-ssh-from-brute-force\/#article","isPartOf":{"@id":"https:\/\/unihost.com\/help\/protect-ssh-from-brute-force\/"},"author":{"name":"Unihost Support","@id":"https:\/\/unihost.com\/help\/#\/schema\/person\/bb5ae95f38577c920e6a7507888b715a"},"headline":"How to Protect SSH from Brute Force Attacks: 5 Main Solutions","datePublished":"2026-05-15T12:39:18+00:00","mainEntityOfPage":{"@id":"https:\/\/unihost.com\/help\/protect-ssh-from-brute-force\/"},"wordCount":881,"publisher":{"@id":"https:\/\/unihost.com\/help\/#organization"},"keywords":["SSH"],"inLanguage":"en"},{"@type":"WebPage","@id":"https:\/\/unihost.com\/help\/protect-ssh-from-brute-force\/","url":"https:\/\/unihost.com\/help\/protect-ssh-from-brute-force\/","name":"How to Protect SSH from Brute Force Attacks","isPartOf":{"@id":"https:\/\/unihost.com\/help\/#website"},"datePublished":"2026-05-15T12:39:18+00:00","description":"Learn how to protect SSH from brute force attacks using SSH keys, disabled root login, login attempt limits, firewall rules, VPN access, Fail2Ban, and CrowdSec.","breadcrumb":{"@id":"https:\/\/unihost.com\/help\/protect-ssh-from-brute-force\/#breadcrumb"},"inLanguage":"en","potentialAction":[{"@type":"ReadAction","target":["https:\/\/unihost.com\/help\/protect-ssh-from-brute-force\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/unihost.com\/help\/protect-ssh-from-brute-force\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Unihost","item":"https:\/\/unihost.com\/"},{"@type":"ListItem","position":2,"name":"Help","item":"https:\/\/unihost.com\/help\/"},{"@type":"ListItem","position":3,"name":"How to Protect SSH from Brute Force Attacks: 5 Main Solutions"}]},{"@type":"WebSite","@id":"https:\/\/unihost.com\/help\/#website","url":"https:\/\/unihost.com\/help\/","name":"Unihost.FAQ","description":"","publisher":{"@id":"https:\/\/unihost.com\/help\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/unihost.com\/help\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en"},{"@type":"Organization","@id":"https:\/\/unihost.com\/help\/#organization","name":"Unihost","alternateName":"Unihost","url":"https:\/\/unihost.com\/help\/","logo":{"@type":"ImageObject","inLanguage":"en","@id":"https:\/\/unihost.com\/help\/#\/schema\/logo\/image\/","url":"https:\/\/unihost.com\/help\/minio.php?2026\/01\/minio.png","contentUrl":"https:\/\/unihost.com\/help\/minio.php?2026\/01\/minio.png","width":300,"height":300,"caption":"Unihost"},"image":{"@id":"https:\/\/unihost.com\/help\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/unihost\/","https:\/\/x.com\/unihost","https:\/\/www.instagram.com\/unihost\/?hl=en","https:\/\/www.linkedin.com\/company\/unihost-com","https:\/\/www.youtube.com\/channel\/UCITKsxMDnslQY8brN3advgw"]},{"@type":"Person","@id":"https:\/\/unihost.com\/help\/#\/schema\/person\/bb5ae95f38577c920e6a7507888b715a","name":"Unihost Support","image":{"@type":"ImageObject","inLanguage":"en","@id":"https:\/\/unihost.com\/help\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/a0c9db17c2a0d93e8a0d5ac123f8c5db750ad4d3d5657369c0c4e480f5af77b8?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/a0c9db17c2a0d93e8a0d5ac123f8c5db750ad4d3d5657369c0c4e480f5af77b8?s=96&d=mm&r=g","caption":"Unihost Support"},"sameAs":["https:\/\/unihost.com\/"],"url":"https:\/\/unihost.com\/help\/author\/support\/"}]}},"_links":{"self":[{"href":"https:\/\/unihost.com\/help\/wp-json\/wp\/v2\/posts\/20115","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unihost.com\/help\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unihost.com\/help\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unihost.com\/help\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/unihost.com\/help\/wp-json\/wp\/v2\/comments?post=20115"}],"version-history":[{"count":2,"href":"https:\/\/unihost.com\/help\/wp-json\/wp\/v2\/posts\/20115\/revisions"}],"predecessor-version":[{"id":20117,"href":"https:\/\/unihost.com\/help\/wp-json\/wp\/v2\/posts\/20115\/revisions\/20117"}],"wp:attachment":[{"href":"https:\/\/unihost.com\/help\/wp-json\/wp\/v2\/media?parent=20115"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unihost.com\/help\/wp-json\/wp\/v2\/categories?post=20115"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unihost.com\/help\/wp-json\/wp\/v2\/tags?post=20115"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}