VPS Security Guide

Essential security practices to protect your virtual private server.

VPS security is your responsibility. Unlike shared hosting, you control security settings. Follow these essential practices to keep your server secure.

Essential VPS Security Measures

1. Secure SSH Access

Change SSH Port:

Edit /etc/ssh/sshd_config
Change Port 22 to Port 2222
Restart SSH: systemctl restart sshd

Disable Root Login:

PermitRootLogin no

Use SSH Keys Instead of Passwords:

ssh-keygen -t rsa -b 4096
Copy public key to server
Disable password auth in sshd_config

2. Configure Firewall

UFW (Ubuntu/Debian):

ufw allow 2222/tcp
ufw allow 80/tcp
ufw allow 443/tcp
ufw enable

FirewallD (CentOS/RHEL):

firewall-cmd --permanent --add-port=2222/tcp
firewall-cmd --reload

3. Install Fail2Ban

Fail2Ban blocks repeated failed login attempts:

apt install fail2ban (Ubuntu)
yum install fail2ban (CentOS)
systemctl enable fail2ban
systemctl start fail2ban

4. Keep System Updated

Ubuntu/Debian:

apt update && apt upgrade -y

CentOS/RHEL:

yum update -y

5. Regular Backups

Backups are your last line of defense. See our VPS backup guide.

Security Checklist

  • ☐ SSH key authentication enabled
  • ☐ Root login disabled
  • ☐ SSH port changed from 22
  • ☐ Firewall configured and active
  • ☐ Fail2Ban installed and running
  • ☐ System updates automatic
  • ☐ Daily backups configured
  • ☐ Strong passwords (20+ characters)
  • ☐ DDoS protection enabled
  • ☐ Security monitoring active

Advanced Security

  • Two-Factor Authentication: Add 2FA for SSH
  • SELinux/AppArmor: Mandatory access control
  • Intrusion Detection: AIDE, Tripwire
  • Log Monitoring: Logwatch, rsyslog
  • Malware Scanning: ClamAV, rkhunter
Taiwan Web Hosting Managed VPS Security

With managed VPS, we handle all security configuration, monitoring, and updates for you. Learn about managed VPS.

Secure VPS Hosting

Taiwan Web Hosting VPS includes DDoS protection, firewall, and security monitoring.