VPS Security Checklist
Securing a VPS means hardening SSH access, enabling a firewall, keeping software patched, running only the services you need, and keeping backups off the server itself. On an unmanaged VPS, none of this happens automatically, since the provider secures the physical hardware and network but leaves everything inside the operating system to you.
Why a fresh VPS is exposed by default
A new VPS typically boots with a root account reachable by password over SSH, no firewall rules configured, and every pre-installed service listening on the network. Automated scanners probe new IP addresses for exactly this configuration within minutes of a server coming online, so hardening is not an optional extra step, it is part of actually finishing the setup. On an unmanaged plan, the provider's responsibility ends at the hardware, network and hypervisor; everything inside the operating system is yours to secure.
SSH hardening
- Create a non-root sudo user and avoid logging in as root for daily work.
- Switch to SSH key authentication and disable password login once a key works.
- Disable direct root login over SSH after the sudo user is confirmed working.
- Consider changing the default SSH port away from 22 to cut down on automated scan noise, though this is a minor convenience, not real security by itself.
- Install fail2ban or a similar tool to temporarily block IP addresses after repeated failed login attempts.
# In /etc/ssh/sshd_config
PasswordAuthentication no
PermitRootLogin no
# Then reload SSH
systemctl restart sshd
Firewall and network rules
A firewall should allow only the ports your services actually need, typically SSH, plus 80 and 443 for a web server, and deny everything else by default.
# Example with ufw on Ubuntu/Debian
ufw default deny incoming
ufw default allow outgoing
ufw allow 22/tcp
ufw allow 80/tcp
ufw allow 443/tcp
ufw enable
| Check | Why it matters |
|---|---|
| Firewall enabled on boot | Rules that reset after a reboot leave the server briefly exposed |
| Database ports not open to the internet | MySQL/PostgreSQL should only accept local or VPN connections |
| Unused services stopped | A service that isn't running can't be attacked |
Updates and minimal services
- Enable automatic security updates for the operating system, or patch on a fixed schedule.
- Remove or disable any pre-installed software, demo sites or default accounts you do not use.
- Keep the web server, PHP, database and any control panel on a currently supported version.
- Run
apt list --upgradable(Debian/Ubuntu) or the equivalent for your distribution periodically if updates are not automated.
Backups and monitoring
A compromised server is easiest to recover from when a clean, recent backup exists somewhere other than the server itself, since an attacker with root access can delete local backups and snapshots stored only on the same machine. Set up automated off-server or provider-level snapshots, and periodically confirm a backup can actually be restored, not just that the job reports success. Pair this with basic monitoring: failed login alerts, disk and CPU usage alarms, and a log review habit, so unusual activity is caught early instead of discovered weeks later.
Frequently asked questions
Is a VPS secure by default?
No. A freshly created VPS typically has password-based root login enabled and no firewall configured, so it needs to be hardened before it is safe to run a real website or application on.
Should I disable root login on my VPS?
Yes, after creating and confirming a working sudo user. Disabling direct root SSH login removes one of the most commonly targeted login paths on any internet-facing server.
Does changing the SSH port actually improve security?
It mainly reduces noise from automated scanners that only probe the default port 22, rather than providing real protection. It should be used alongside key-based authentication and a firewall, not instead of them.
How often should I update a VPS?
Security updates should be applied as soon as they are available, ideally through automatic updates for the operating system. Major software like the web server, PHP or database should be checked at least monthly if updates are not automated.
Why do I need backups if I have a firewall and strong passwords?
No single defense is guaranteed to stop every attack, and mistakes, failed updates or hardware issues can cause data loss even without an attacker. An off-server backup is the recovery option when prevention fails.
What is fail2ban and do I need it?
Fail2ban is a tool that watches login logs and temporarily blocks IP addresses after repeated failed attempts, which cuts down on brute-force SSH and login attacks. It is a lightweight, commonly recommended addition for any internet-facing VPS.
Related topics
- What Is a VPS (Virtual Private Server)? VPS & Cloud
- What Is SSH (Secure Shell)? VPS & Cloud
- What Is a Firewall? Security & SSL
- Managed vs. Unmanaged VPS Hosting VPS & Cloud
- What Is an IP Address? Networking & IP