How to Secure Linux VPS with Fail2ban & SSH Key Authentication: Stop Brute-Force Attacks
Hostinger vs. Contabo: Full Specifications Breakdown
Data verified from our lab benchmarks • Updated for 2026
| Feature / Metric | HostingerEditor's Choice UI | ContaboMax RAM Value |
|---|---|---|
| Starting Price | $2.99 / month (Web) | $4.99 / mo (VPS) | $5.50 / month (Cloud VPS S) |
| vCPU Cores | 1 to 8 vCPU (Dedicated resources) | 4 to 12 vCPU (High Core Count) |
| RAM Memory | 4 GB to 32 GB | 6 GB to 64 GB (Gigantic RAM) |
| Storage Technology | 50 GB – 400 GB NVMe SSD | 50 GB NVMe or 300 GB SSD |
| Traffic / Bandwidth | 4 TB to 32 TB | 32 TB Outgoing + Unlimited In |
| Control Panel & UI | hPanel (Ultra Modern & Easy) | cPanel, Plesk, Webmin, or CLI |
| Customer Support | 24/7 Live Chat & AI Support (Multi-lingual) | Email Ticket Support (German Business Hours) |
| Best For | Bloggers, WordPress Sites & Devs wanting easy UI | Heavy Database, Docker, Game Servers & SysAdmins |
| Money-Back Guarantee | 30-Day Money-Back Guarantee | 14-Day EU Statutory Cancellation |
| Official Links | Visit Hostinger | Visit Contabo |
Within 10 minutes of launching a public VPS, automated bots begin brute-forcing port 22. Learn how to secure your server with SSH keys, non-standard ports, and Fail2ban.
- Permanently halts automated dictionary attacks and password-guessing botnets
- Ed25519 cryptographic SSH keys provide mathematical immunity against brute-force penetration
- Fail2ban automatically writes dynamic firewall drop rules against repeat offenders
The Threat Landscape for New VPS Deployments
Every public IPv4 address on the internet is continuously scanned by automated botnets within minutes of being provisioned on Contabo or Hostinger. If you check your auth log with grep 'Failed password' /var/log/auth.log, you will likely see thousands of failed SSH login attempts from IP addresses worldwide trying generic usernames like root, admin, test, and ubuntu.
Leaving root password authentication enabled on default port 22 is an unacceptable security vulnerability. In this guide, we implement a three-tiered security shield: Ed25519 SSH Key Authentication, custom port assignment, and Fail2ban automated intrusion prevention.
Step 1: Generate an Ed25519 SSH Key Pair
On your local computer (Mac, Linux, or Windows PowerShell), generate an ultra-secure Ed25519 SSH key:
ssh-keygen -t ed25519 -C "admin@yourdomain.com"
Copy your public key to your VPS server:
ssh-copy-id -i ~/.ssh/id_ed25519.pub root@YOUR_SERVER_IP
Step 2: Hardening the SSH Daemon Configuration
SSH into your VPS and edit the main OpenSSH daemon configuration file:
sudo nano /etc/ssh/sshd_config.d/99-hardened.conf
Paste the following security directives (choosing a custom high port such as 2244):
# Change default port to evade automated port scanners
Port 2244
# Disable root login and enforce cryptographic keys only
PermitRootLogin prohibit-password
PasswordAuthentication no
PubkeyAuthentication yes
AuthorizedKeysFile .ssh/authorized_keys
# Restrict authentication attempts
MaxAuthTries 3
ClientAliveInterval 300
ClientAliveCountMax 2
X11Forwarding no
Critical Rule: Update Firewall Before Restarting SSH!
If you change your SSH port to 2244 without updating UFW firewall rules, you will lock yourself out of your server! Run the following commands before restarting SSH:
sudo ufw allow 2244/tcp
sudo ufw enable
sudo sshd -t
sudo systemctl restart ssh
Do not close your current terminal window! Open a new local terminal and test connecting with your key over the new port:
ssh -p 2244 -i ~/.ssh/id_ed25519 root@YOUR_SERVER_IP
Step 3: Installing & Configuring Fail2ban
Fail2ban monitors system log files and dynamically modifies your netfilter/iptables firewall to drop IP addresses that display malicious login behavior. Install Fail2ban:
sudo apt update && sudo apt install -y fail2ban
Create a local jail override file:
sudo cp /etc/fail2ban/jail.conf /etc/fail2ban/jail.local
sudo nano /etc/fail2ban/jail.local
Configure the [sshd] section with your custom port and aggressive ban rules:
[sshd]
enabled = true
port = 2244
mode = aggressive
filter = sshd
logpath = /var/log/auth.log
maxretry = 3
findtime = 600
bantime = 86400
This configuration dictates that if an IP fails authentication 3 times within 10 minutes (600s), Fail2ban blocks all network packets from that IP for a full 24 hours (86,400s).
Step 4: Activating & Monitoring Fail2ban
Enable and start the Fail2ban service:
sudo systemctl enable --now fail2ban
sudo fail2ban-client status sshd
You can view the real-time list of currently banned malicious IP addresses:
sudo fail2ban-client status sshd
# Output displays:
# Currently failed: 0
# Total failed: 14
# Currently banned: 2
# Banned IP list: 185.220.101.42 194.26.29.112
Recommended Reading & Related Guides
Summary
By enforcing Ed25519 SSH keys, disabling password authentication, moving off port 22, and deploying Fail2ban, your Linux VPS on Hostinger or Contabo transforms from an easy target into a fortified fortress.
Video Walkthrough & Official References
Linux Server Security Tutorial: SSH, UFW Firewall & Fail2ban • DevOps Made Simple
Editorial Verdict: Pros & Cons
What We Love (Pros)
- Permanently halts automated dictionary attacks and password-guessing botnets
- Ed25519 cryptographic SSH keys provide mathematical immunity against brute-force penetration
- Fail2ban automatically writes dynamic firewall drop rules against repeat offenders
Drawbacks (Cons)
- Improper configuration can lock you out; always maintain an active terminal session while testing
Written by Viktor Chen
Systems Performance Engineer
Alex and the ServerCraft engineering lab run routine benchmarks on over 25 web hosting providers, maintaining strict objectivity and reproducibility.
Recommended Next Reads
How to Enable Google BBR TCP Congestion Control on Ubuntu VPS for 30% Faster Network Speeds
Unlock massive throughput gains and slash latency on your Linux VPS. Learn how to activate Google's BBR TCP congestion control algorithm in 3 minutes.
Contabo DDoS Protection Review: Does Built-In Anti-DDoS Actually Protect Against Layer 4 & Layer 7 Attacks?
Can Contabo's free DDoS mitigation handle real-world cyberattacks? We examine network filtering architectures, scrubbing centers, and Layer 7 protection.
How to Deploy Laravel 11 Apps on Hostinger KVM VPS with Coolify: Complete CI/CD Pipeline
Stop overpaying for Laravel Forge. Learn how to deploy modern PHP & Laravel applications on Hostinger KVM VPS using Coolify, automated GitHub webhooks, and Redis queues.