SliceScope

Securing a New VPS: The First 15 Minutes

Posted Aug 31, 2026

The most important VPS security work takes about fifteen minutes and happens before you deploy anything: switch to SSH keys and disable password login, create a non-root sudo user, turn on a firewall, and enable automatic security updates. Those four steps remove the large majority of the risk a fresh, internet-facing server faces — most attacks are automated bots trying default passwords, and this checklist shuts them out. What follows is that checklist in order, plus a couple of worthwhile extras.

Use SSH keys and disable password login

This is the single highest-impact step. Generate an SSH key pair on your own computer, add the public key to the server, confirm you can log in with it, then disable password authentication in the SSH configuration entirely. Once password login is off, the automated bots that hammer every server on the internet trying common passwords simply can't get in — they have nothing to guess. Most providers let you add your public key at creation time so the box starts key-only. Keep your private key safe and passphrase-protected; it's now the key to the server.

Create a non-root sudo user

Don't run day-to-day as root. Create a regular user, add it to the sudo (or wheel) group so it can run privileged commands when needed, copy your SSH key to it, and then disable direct root login over SSH. Working as a normal user with sudo means a mistake or a compromised process doesn't automatically have full control of the machine, and it gives you an audit trail of privileged actions. This pairs with key-only login: root disabled, password login disabled, and a named user that you actually log in as.

Turn on a firewall

Close every port you're not using. On Ubuntu or Debian, ufw makes this simple: allow SSH and your web ports (80 and 443), then enable the firewall to deny everything else by default. Many providers also offer a network-level firewall in their control panel, which is worth using in addition because it filters traffic before it even reaches your server. The principle is least exposure: a service that isn't reachable from the internet can't be attacked from it, so only open what you actually serve.

Enable automatic security updates

Unpatched software is how servers get compromised long after setup. Turn on automatic security updates — unattended-upgrades on Debian and Ubuntu — so the system installs security patches without you having to remember. Reboot when a kernel update needs it (or use a livepatch service if uptime matters). This one setting closes the slow-motion vulnerability of a box that was secure on day one and quietly fell behind. Combined with the steps above, it keeps a server safe with almost no ongoing effort.

Worthwhile extras: fail2ban and backups

Two more steps repay the effort. Install fail2ban to watch logs and temporarily block IP addresses that show abusive patterns — a useful backstop even with key-only SSH, especially once you run other services. And set up backups you've actually tested: a provider snapshot on a schedule plus an off-server copy of your important data, because a backup you can't restore isn't a backup. If your VPS is destroyed, misconfigured or compromised, a recent, tested backup turns a disaster into an inconvenience. These aren't day-one-critical, but do them in the first week.

The takeaway

A VPS is only as safe as its setup, and the setup that matters most is fast and free: keys not passwords, a non-root user, a firewall, and automatic updates. Do those on every new box before you deploy, add fail2ban and tested backups in the first week, and an unmanaged server is genuinely secure without ongoing drama. This is also the honest answer to 'is a VPS safe for a beginner?' — yes, if you run this checklist. Pick a provider from our best VPS hosting ranking, size it with our guide to choosing VPS specs, and harden it before you ship.

Security myths worth ignoring

A couple of popular tips do less than people think. Changing the SSH port from 22 to something obscure is often presented as a security step, but it's security by obscurity: it quiets the noise in your logs from automated scanners, yet it stops no determined attacker and does nothing that key-only login hasn't already handled. Do it if you like a cleaner log, but don't mistake it for real protection. Likewise, installing a pile of security tools you don't understand can create more risk than it removes — a misconfigured intrusion-detection system or a firewall rule that locks you out is its own problem. The fundamentals — keys, no root login, a firewall, updates — matter far more than exotic add-ons.

Secrets and least privilege are where real breaches happen, so give them attention. Keep API keys, database passwords and tokens out of your code repository and in environment files or a secrets manager, with file permissions that only your app user can read. Run each service as its own limited user rather than as root, so a compromise of one process doesn't hand over the machine. And expose only what must be public: bind your database to localhost so it's reachable only from the server itself, not the open internet. These habits cost nothing and close the paths attackers actually use once the obvious front door is locked.

Finally, make security a five-minute monthly habit rather than a one-time event. Once a month, confirm automatic updates are actually applying (check the logs), verify your backups restore by testing one, glance at auth logs or fail2ban for anything odd, and remove any users or keys you no longer need. That short ritual catches the slow failures — a broken update timer, a backup that silently stopped — that turn a secure server into a vulnerable one over time. Security isn't a box you tick on day one; it's a small amount of upkeep that keeps the day-one hardening true months later, and it's what makes an unmanaged VPS genuinely safe to run.

Common questions

What is the first thing to do on a new VPS?
Switch to SSH key authentication and disable password login. That single change locks out the automated bots that try common passwords against every server on the internet. Then create a non-root sudo user, enable a firewall, and turn on automatic security updates — four steps, about fifteen minutes, and most of the risk is gone.
Is an unmanaged VPS safe for a beginner?
Yes, provided you run the day-one checklist: SSH keys instead of passwords, a non-root sudo user, a firewall, and automatic security updates. Those steps take an afternoon and remove the large majority of risk. The real danger isn't the VPS — it's leaving a box on default settings and unpatched. If you won't do the basics, choose managed hosting.
Do I need fail2ban if I use SSH keys?
It's not strictly necessary for SSH once password login is disabled, but it's still worth installing. Fail2ban blocks abusive IPs across any service you run, not just SSH, so it becomes more valuable as you add a web app, mail, or other listeners. Think of it as a low-effort backstop rather than your primary defence.

Put this in context: the best VPS hosting, ranked, or VPS vs dedicated vs cloud.