AltivoraAltivora
Back to Blog Overview
LinuxSecurityUFWFail2banSSHHardening

Linux VPS Security Hardening: SSH Keys, UFW Firewall & Fail2ban

Altivora Security Team
11 min read

1. Disable Password Authentication & Root Login

In /etc/ssh/sshd_config:

PermitRootLogin prohibit-password
PasswordAuthentication no
Port 2222

2. Configure UFW Firewall

sudo ufw default deny incoming
sudo ufw default allow outgoing
sudo ufw allow 2222/tcp comment 'Custom SSH'
sudo ufw allow 80/tcp comment 'HTTP'
sudo ufw allow 443/tcp comment 'HTTPS'
sudo ufw enable

3. Install & Configure Fail2ban

Automatically ban IPs that trigger multiple failed authentication attempts:

[sshd]
enabled = true
port = 2222
maxretry = 3
bantime = 1d
findtime = 10m
High-Performance Infrastructure

Deploy Dedicated NVMe Cloud VPS

Deploy high-IOPS Gen4 NVMe compute across USA, Germany (Frankfurt), India (Mumbai & Noida), and Singapore. Instant setup & enterprise DDoS protection.

Explore VPS Plans

Related Technical Guides

Ready to upgrade your infrastructure?

Experience the Altivora difference with a 99.9% uptime SLA and 60-second setup.