Home/Blog/Cybersecurity
Cybersecurity⚡ Advanced
10 min read
October 08, 2026

Best Practices for Securing Linux Cloud Servers Against Brute-Force Attacks

Technical Blueprint & Architecture Summary
Target EnvironmentUbuntu 24.04 / Debian 12
Hardware Reqs1 vCPU • 1GB RAM • NVMe
Verification Status Production Tested
🔒
Marcus Sterling
Security Operations Director
#Cybersecurity#SSH Hardening#Fail2Ban#UFW Firewall#Cloud Security

Threat Landscape

Within seconds of provisioning a public IP on any cloud hosting provider, automated botnets and malicious scanners begin probing port 22 with dictionary-based username/password combinations. If left with default configurations, weak credentials can lead to server hijacking, cryptojacking, and data leaks.

This production checklist hardens Linux cloud instances against unauthorized intrusion.


1. Enforce Ed25519 SSH Key Pair Authentication

Password authentication should be completely eradicated from public cloud servers. Ed25519 offers state-of-the-art elliptic curve cryptography with smaller key sizes and superior performance compared to legacy 2048-bit RSA.

Generating the Key Pair (on your local machine):

bash terminal
ssh-keygen -t ed25519 -C "admin@edutechz-vps"

Installing the Key on Your Server:

bash terminal
ssh-copy-id -i ~/.ssh/id_ed25519.pub root@YOUR_SERVER_IP

2. Hardening `/etc/ssh/sshd_config`

Edit the OpenSSH server daemon configuration file:

bash terminal
sudo nano /etc/ssh/sshd_config.d/99-hardened.conf

Add the following directives:

text terminal
# Change default port (mitigates 98% of dumb bot scanners)
Port 2244

# Prohibit empty passwords and disable password-based login completely
PermitEmptyPasswords no
PasswordAuthentication no
KbdInteractiveAuthentication no

# Only permit public key authentication
PubkeyAuthentication yes

# Limit authentication attempts per connection
MaxAuthTries 3
LoginGraceTime 30

# Prohibit direct root login (force named sudoers)
PermitRootLogin prohibit-password

# Modern Cryptographic Ciphers & Algorithms
KexAlgorithms curve25519-sha256,curve25519-sha256@libssh.org,diffie-hellman-group16-sha512
Ciphers chacha20-poly1305@openssh.com,aes256-gcm@openssh.com
MACs hmac-sha2-512-etm@openssh.com

Test the configuration for syntax errors before restarting:

bash terminal
sudo sshd -t && sudo systemctl restart ssh

3. Deploy Fail2Ban with Auto-Banning Jails

Fail2Ban monitors log files (such as `/var/log/auth.log`) for suspicious failed authentication attempts and updates firewall rules to reject offenders.

bash terminal
sudo apt install -y fail2ban
sudo cp /etc/fail2ban/jail.conf /etc/fail2ban/jail.local

Edit `/etc/fail2ban/jail.local`:

ini terminal
[DEFAULT]
bantime  = 1h
findtime = 10m
maxretry = 3
banaction = ufw

[sshd]
enabled = true
port    = 2244
logpath = %(sshd_log)s
backend = %(default_backend)s

Restart Fail2Ban:

bash terminal
sudo systemctl enable --now fail2ban
sudo fail2ban-client status sshd

4. Configure UFW (Uncomplicated Firewall) Rate Limiting

UFW includes a built-in stateful rate-limiting module that dynamically rejects IP addresses attempting more than 6 connections within 30 seconds:

bash terminal
# Default policies: deny inbound, allow outbound
sudo ufw default deny incoming
sudo ufw default allow outgoing

# Apply rate limiting to your custom SSH port
sudo ufw limit 2244/tcp comment 'Rate-limited SSH'

# Allow standard web traffic if running websites
sudo ufw allow 80/tcp comment 'HTTP'
sudo ufw allow 443/tcp comment 'HTTPS'

# Enable firewall
sudo ufw enable

Summary Checklist

  • [x] Password authentication disabled.
  • [x] Ed25519 cryptographic keys installed.
  • [x] Default SSH port shifted from 22.
  • [x] Fail2Ban active with 1-hour ban duration.
  • [x] UFW rate limiting active.
  • Deploy On Edutechz NVMe Cloud

    Need clean IP addresses, DDoS mitigation, and 10 Gbps uplinks to run your proxies, containers, or Windows servers? Deploy your instance in 60 seconds.

    Explore Cloud Plans

    Recommended Technical Guides

    Networking & Privacy

    How to Set Up a High-Performance MTProto Proxy on Ubuntu 24.04 LTS

    9 min read
    Windows RDP

    Step-by-Step Windows RDP Optimization for High-Latency Connections

    8 min read
    DevOps & Cloud

    How to Run Docker Containers Smoothly on Low-RAM VPS (1GB - 2GB RAM)

    9 min read