Budget VPS plans give you root access and full control for a few dollars a month. That freedom becomes a liability when you skip the basics. I've restored dozens of cheap VPS instances after they were compromised, ran out of disk space mid-upgrade, or collapsed under load because swap was never configured.
Most failures trace back to nine repeating mistakes. Fix these during your first hour and your $5 server will outlast many expensive ones.
1. Leaving SSH open on port 22 with password authentication
Default SSH configuration accepts passwords on port 22. Bots scan that port constantly. A weak password gets brute-forced in hours.
Move SSH to a non-standard port and disable password login entirely:
sudo nano /etc/ssh/sshd_config
Change these lines:
Port 2849
PermitRootLogin no
PasswordAuthentication no
PubkeyAuthentication yes
Restart SSH:
sudo systemctl restart sshd
Before you close your current session, test the new port in a second terminal window. If you lock yourself out, most VPS control panels provide a web console for recovery.
Use SSH keys exclusively. Generate a key pair on your local machine if you haven't already:
ssh-keygen -t ed25519 -C "[email protected]"
Copy the public key to your VPS:
ssh-copy-id -p 2849 your_user@your_vps_ip
2. Skipping a firewall entirely
A fresh VPS often has every port open. Any service you install becomes reachable from the internet immediately.
Install and configure ufw (Uncomplicated Firewall) before you install anything else:
sudo apt update && sudo apt install ufw
sudo ufw default deny incoming
sudo ufw default allow outgoing
sudo ufw allow 2849/tcp # your SSH port
sudo ufw allow 80/tcp
sudo ufw allow 443/tcp
sudo ufw enable
Check the status:
sudo ufw status verbose
Add rules only for services you're actually running. If you're not hosting email, don't open port 25.
3. Running services as root
Many quick-start guides tell you to run Node apps, Python scripts, or databases as root. That's fast. It's also how a single vulnerability in your app gives an attacker full system control.
Create a dedicated user for each service:
sudo useradd -r -s /bin/false appuser
Change ownership of your application directory:
sudo chown -R appuser:appuser /opt/yourapp
Configure your process manager (systemd, PM2, supervisor) to run the service as that user. For a systemd unit:
[Service]
User=appuser
Group=appuser
WorkingDirectory=/opt/yourapp
ExecStart=/usr/bin/node server.js
Databases should run as their own users too—MySQL runs as mysql, PostgreSQL as postgres. Never change those to root.
4. Ignoring swap configuration
Cheap VPS plans often include 1 GB of RAM or less. Without swap, the OOM killer terminates processes randomly when memory fills up. Your database or web server dies mid-request.
Check current swap:
sudo swapon --show
free -h
If swap is zero, create a swap file. For a 1 GB VPS, a 2 GB swap file is reasonable:
sudo fallocate -l 2G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
Make it permanent:
echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab
Adjust swappiness so the system doesn't swap aggressively:
sudo sysctl vm.swappiness=10
echo 'vm.swappiness=10' | sudo tee -a /etc/sysctl.conf
5. No backups until disaster strikes
You'll set up backups "later." Later never comes. Then a kernel panic corrupts your filesystem or you accidentally drop the production database.
Schedule automated backups on day one. Many VPS providers offer snapshot services; enable weekly snapshots if available.
For file-level backups, install restic or duplicity and push to object storage:
sudo apt install restic
restic init -r s3:s3.amazonaws.com/your-backup-bucket
Create a backup script:
#!/bin/bash
restic -r s3:s3.amazonaws.com/your-backup-bucket backup /etc /var/www /home
restic -r s3:s3.amazonaws.com/your-backup-bucket forget --keep-daily 7 --keep-weekly 4 --prune
Run it daily via cron:
sudo crontab -e
Add:
0 2 * * * /usr/local/bin/backup.sh
Test a restore before you need it.
6. Installing everything on one server without isolation
You install a web server, then a mail server, then a game server, then a VPN. One misconfigured service compromises everything. Troubleshooting becomes impossible because logs and processes overlap.
Use separate VPS instances for separate functions, or at minimum use containers (Docker) to isolate services. A $5/month VPS is cheap enough to run three of them—one for web, one for databases, one for experiments.
If you must run multiple services on one box, use systemd units and separate users so each service has clear boundaries.
7. Letting disk space fill up
Log files grow. Package caches accumulate. Your disk fills to 100% and everything breaks—SSH stops accepting connections, databases lock up, package managers fail mid-upgrade.
Set up disk space monitoring before you deploy anything. A simple cron job can email you when space drops below 20%:
#!/bin/bash
USAGE=$(df / | grep / | awk '{ print $5 }' | sed 's/%//g')
if [ $USAGE -gt 80 ]; then
echo "Disk usage is ${USAGE}%" | mail -s "Disk Alert" [email protected]
fi
Clean up regularly:
sudo apt autoremove
sudo apt clean
sudo journalctl --vacuum-time=7d
Rotate logs:
sudo nano /etc/logrotate.d/custom
Add:
/var/log/yourapp/*.log {
daily
rotate 7
compress
delaycompress
missingok
notifempty
}
8. Running outdated software and skipping security patches
You install Ubuntu or Debian and forget about it. Months later, unpatched vulnerabilities are public knowledge. Attackers scan for them automatically.
Enable unattended security upgrades:
sudo apt install unattended-upgrades
sudo dpkg-reconfigure -plow unattended-upgrades
Edit the config if you want stricter control:
sudo nano /etc/apt/apt.conf.d/50unattended-upgrades
Check for updates manually once a week:
sudo apt update && sudo apt upgrade
Subscribe to security mailing lists for your distribution so you know when critical patches land.
9. No monitoring or alerting
Your site goes down at 3 AM. You find out when a client emails you eight hours later.
Set up basic uptime monitoring with a free service (UptimeRobot, Hetrixtools) that pings your server every few minutes and emails you when it's unreachable.
For resource monitoring, install netdata:
bash <(curl -Ss https://my-netdata.io/kickstart.sh)
Access the dashboard at http://your_vps_ip:19999. Configure firewall rules so only your IP can reach it, or set up Nginx with basic auth as a reverse proxy.
For lightweight CLI monitoring, use htop and iotop to spot resource hogs:
sudo apt install htop iotop
What breaks first when you skip these steps
In support tickets I handled, the usual sequence was: SSH brute-force creates a backdoor user, that user installs a cryptominer, CPU pegs at 100%, legitimate services become unresponsive, and the provider suspends the VPS for abuse.
Or disk space fills during a routine update, APT locks, SSH can't write logs so it stops accepting connections, and you're stuck using a slow web console to fix it.
All of these are fixable in under an hour if you catch them in the first week.
FAQ
Do I really need swap on a VPS with SSD storage?
Yes. Swap prevents the OOM killer from terminating processes unpredictably. SSD wear from swap is negligible compared to the cost of unexpected downtime.
Can I use iptables instead of ufw?
You can, but ufw is a simpler frontend for iptables. If you're comfortable writing raw iptables rules, go ahead—just make sure you have a rescue console before you enable them.
How often should I test restores?
Once a quarter, or whenever you change your backup process. A backup you've never restored is a backup you don't have.
What if my VPS provider doesn't offer snapshots?
Use file-level backup tools like restic, duplicity, or borg and push to external object storage. Snapshots are convenient but not a substitute for off-site backups.
Should I disable IPv6 if I'm not using it?
If your firewall rules only cover IPv4, an attacker can reach your services over IPv6. Either disable IPv6 entirely or write matching firewall rules for it.
Fix these in your first hour
Every cheap VPS starts the same: root access, default config, all ports open. Spend an hour hardening SSH, configuring swap, enabling the firewall, and scheduling backups. That hour prevents weeks of downtime and recovery work later.
Check your running VPS instances now. If you skipped any of these nine, fix them today.
