All systems operational 12 elite locations · Europe & Asia Pay with crypto · 0 KYC
Home / Guides / VPS security hardening: 12 steps in order
Guide

VPS Security Hardening Checklist: 12 Steps After the First Login

Padlocks and chain on a dark background

Twelve hardening steps in order — keys, default-deny firewall, unattended patches, fail2ban, tested restores — on a no-KYC Core VPS from $4.80/mo annual-eff.

Short answer

Twelve hardening steps in order — keys, default-deny firewall, unattended patches, fail2ban, tested restores — on a no-KYC Core VPS from $4.80/mo annual-eff.

The default is the vulnerability

Ask what actually breaks into VPS boxes and the answer is embarrassingly unglamorous: not zero-days against the kernel, but password authentication left on and a root password that survived an automated scan. Brute-force noise against a fresh public IPv4 starts within minutes of first boot, and every attempt is a guess at the one credential the default install accepts. The order below exists because of that asymmetry — a boring default defeats more attacks than any exotic tool you could install afterward.

The mechanism behind the noise is economic. Botnets scan the entire IPv4 space continuously because password guessing is cheap; anything that makes the guess expensive filters the botnet out, and anything that makes it impossible filters everything out. Key-only authentication makes it impossible rather than expensive, a default-deny firewall makes most of the surface invisible, and unattended patches close the holes that remain. None of it is subtle — the discipline is in the order and the follow-through, not in the tools.

Where people misorder it: installing a monitoring stack, hardening nginx, tuning databases — all before the keys are in place. The box is exposed from the moment it images, roughly 60 seconds after payment, and the scan arrives regardless of whether you have finished your coffee. Weeks of careful application work do not survive a weak first hour, because the attacker does not wait for your roadmap.

Everything on this list fits in the first thirty minutes, and the steps are ordered so each one shrinks the next one's risk. If you only ever do the first two — keys and firewall — you have removed the failure modes that actually end most boxes. The rest is depth, and depth is what this page is for; the recap at the end compresses it all into one runnable sequence.

VPS from $4.80* — Core on the annual term (list $6/mo), one invoice for 12 months, no auto-charges. Dedicated with IPMI from $39.20/mo. Crypto invoice, no KYC.

Launch now

Keys first, then close the password door

Step one is adding your SSH public key and disabling password authentication for root — before anything else touches the network. Generate a modern pair with ssh-keygen -t ed25519, install the public half with ssh-copy-id or by appending to ~/.ssh/authorized_keys, then set PasswordAuthentication no and PermitRootLogin prohibit-password in sshd_config(5) and reload sshd. From that moment the traffic that started within minutes of boot becomes permanently harmless noise.

The mechanism is credential elimination rather than credential protection: a key-only server has no password to guess, so the daily attempts in your logs become noise with no possible success path. RFC 4253 defines the transport the keys ride; the practical point is simpler — the secret never crosses the wire, so nothing on the network can capture it, and nothing in your logs can leak it. Create a named sudo user for daily work at the same time, and reserve root for console and rescue contexts only.

Where this step bites: locking yourself out. Keep the hosting panel's console open while you reload sshd, and test a second terminal before you close the first one. The panel console is the out-of-band path that turns an sshd typo into a five-minute fix instead of a rebuild, and it is also the reason the mistake is recoverable at all — which is a property of the hosting layer, not of your config.

Key management outlives the setup: one key per human, one per automation account, each carrying a comment that names its owner, and nothing shared between laptops. Adding a teammate is an append to authorized_keys, not a ceremony; when someone leaves, deleting their line is the whole revocation. That property — named keys, named users, single-line removal — is what makes the 10 extra minutes on day one worth every later audit.

Reaching the box through a tunnel instead of exposing 22/tcp at all is the upgraded version of this step — the WireGuard guide covers it end to end. Either way, identity is now settled; the next surface is everything the box answers to strangers, and that list is shorter than most people think before they actually run the audit.

Default-deny is a list, not an appliance

A firewall is not a product you install; it is a policy you maintain. Set it to default-deny and allow exactly 22/tcp (or your moved port), 80/tcp and 443/tcp for web, and one port per running service that genuinely needs the network. The nftables wiki carries the ten-minute syntax tour, and nft list ruleset shows what is actually enforced — which is occasionally not what you believe, and the gap between those two things is where incidents live.

Audit before you allow: ss -tulpn (ss(8)) lists every listening socket and the process behind it. Anything bound to 0.0.0.0 that you cannot name is either a service you forgot or one you never installed on purpose — both answers require action, and only one of them is comfortable. Admin interfaces and databases bind to 127.0.0.1, or live behind the tunnel from the previous section, and nothing that answers publicly should exist without a reason you can say out loud.

Where default-deny goes wrong: the established-connections rule gets left out, and the box answers SYNs but never completes a handshake — five confusing minutes until someone reads the rulebook line by line. Second classic: the panel firewall and the in-guest firewall disagree, and the tighter one silently wins. When the two layers disagree, you want to know which one is authoritative before the incident, not during it, so pick one layer to maintain and document the other as read-only.

A minimal ruleset you can recite from memory beats a clever one you cannot debug at 3 a.m., and that is a design constraint, not a confession. With the network surface bounded, the remaining noise is whatever still gets through to what you chose to expose — which is a logging problem more than a security one, and logging problems have cheap solutions.

Make the brute-force noise readable

After the firewall, the auth log on any public box fills with failed attempts within the hour. fail2ban exists to make that readable: it watches /var/log/auth.log, counts failures per source, and instructs the firewall to drop repeat offenders for a period. Install it, then check fail2ban-client status sshd to watch the ban list grow — proof the loop works end to end, and a small daily satisfaction once you see how much of the internet is just this.

The mechanism is nuisance pricing, not prevention: key-only authentication already made guessing impossible, so fail2ban's contribution is log hygiene and bandwidth savings rather than security in the strict sense. Set bantime and findtime to something with teeth — an hour, not five minutes — and whitelist your own addresses so a mistyped key three times in a row does not lock you out of your own box at the worst possible hour.

Filters deserve a smoke test before you trust them: run fail2ban-regex against a sample of real log lines and confirm the pattern matches what your distribution actually writes, which varies by version. A jail that matches 0 lines runs silently forever, offering the comfort of a shield with the coverage of a colander. Two minutes with the regex tool answers the question the dashboard never will.

Where it breaks: a bantime so short the same host returns immediately, jails enabled for services that do not exist on the box, and the eternal classic — banning your own IP through a NAT edge that everything behind it shares. sshguard is the lighter alternative when a full jail framework is more than the box deserves; either tool beats the third option, which is reading thousands of failed-login lines a week out of obligation.

With identity, surface and noise handled, the box is now harder to enter than the vast majority of servers on the internet. The remaining risks run on a clock you control poorly: the software itself, which ages whether or not anyone attacks it. That is the patching problem, and it is solved by removing your calendar from the loop entirely.

Patches without a calendar

Every CVE that lands for your distribution is a reminder you will eventually miss. Unattended upgrades remove the miss: on Debian-family systems, apt install unattended-upgrades enables a daily run that pulls security patches automatically — the Debian wiki documents the exact behavior — and the /etc/apt/apt.conf.d/50unattended-upgrades file decides what counts as security. After the first enablement, the box patches itself on a schedule you never have to remember again.

The mechanism has one gap automation cannot cross: the kernel. A patched kernel waits in memory until reboot, and /var/run/reboot-required is the flag that says one is pending — check it weekly, or restart on a fixed schedule you chose. Debian's security portal is where the advisories come from; the box does not need you to read them, only to restart occasionally, which is the cheapest security labor you will ever buy.

Verify the automation once instead of assuming it: unattended-upgrade --dry-run --debug shows what the next run would fetch, and the history of what it actually did accumulates under /var/log/unattended-upgrades/ for comparison against the settings in 50unattended-upgrades. Automation you have never watched run is a checkbox, not a control; automation you have watched once, with logs to check against, is both — and re-checking after each distribution point release keeps it honest.

Where it breaks: mixing repositories until apt holds broken packages, disabling the unattended service 'temporarily' during a big change and never re-enabling it, and EOL releases — an out-of-support distribution stops receiving the very pocket automation reads from, so the machine looks maintained while patching has silently stopped. Second-order break: restarting a busy service mid-day when a quiet-hour restart would have been invisible to every user you have.

Patches protect the software you run; the next two steps protect the data underneath it — one copy elsewhere, and one copy unreadable without a key. Of the two, the first is the one people skip, and it is the one that decides whether a bad day becomes an inconvenience or an ending, so it goes next.

An unrestored backup is a rumor

Schedule snapshots as the pre-change rollback, add an off-box copy on different storage, and then — the step that separates a backup from a hope — run a restore into a scratch directory and prove the chain works. rsync -a --delete to a second location plus a periodic full snapshot covers most small servers, and crontab -e (crontab(5)) schedules both without installing anything new.

The mechanism is blast-radius control. A compromised or corrupted box with a tested restore is a 15-minute incident; the same box with an untested backup is potentially a total loss, because untested backups fail for the friendliest reasons — the job silently stopped in March, the destination filled up in June, the encryption key lives on the very disk it was supposed to protect. Every one of those failures is invisible until the day you need the copy, which is precisely why the rehearsal is not optional.

Verification closes the loop: after each rehearsal, compare the restored tree against expectations and record how long the whole procedure took, because the recovery-time number is the one your future self will actually need at 3 a.m. A backup with an unknown restore time is a plan missing its central parameter. Write the number next to the schedule and refresh it every quarter with the same routine, so the plan and its arithmetic age together instead of apart.

Where backup plans break: everything living on the same physical machine (a snapshot is not a backup), credentials for the off-box copy stored where an attacker can read them, and restores that were never rehearsed even once. Quarterly is the honest cadence for the rehearsal — put it in the calendar next to the reboot check, and treat a skipped quarter as a failed check rather than a delayed one.

Restores also bound the damage of the failure mode automation cannot prevent: operator error, which is how most production data actually dies. The last defensive layer changes the stakes again — data that is unreadable without a key is data a stolen disk cannot surrender, no matter who carries it out of the building.

Encrypt the disk, unlock it after boot

Put sensitive data at rest into a LUKS container opened after boot, and a physical or imaging compromise of the powered-off disk yields ciphertext instead of your database. The cryptsetup project maintains the tooling: cryptsetup luksFormat builds the container, /etc/crypttab names it at boot, and cryptsetup luksOpen brings it up. The pattern is one paragraph of config and one passphrase, and it converts 'stolen disk' from an incident into a non-event.

The headless problem is the real design constraint: a passphrase entered at boot needs something to type it into. On the dedicated tiers, IPMI gives you that console — remote KVM, virtual media, the works — which is why encrypted dedicated metal is straightforward: Rent Forge at $49/mo list — $39.20/mo on the annual term — and the unlock is just a remote console session after each reboot, with 2 x 1 TB of NVMe sitting unreadable behind it whenever the box is off. On a VPS, the provider console serves the same role, just with less bandwidth.

Protect the header as carefully as the data: cryptsetup luksHeaderBackup writes the small file that can revive a damaged container, and losing both the header and the passphrase ends the conversation permanently. Store that backup off-box under the same custody rules as the passphrase itself. Two artifacts, 2 locations, and the encryption layer becomes boring in exactly the way the rest of this checklist aims for.

Where it breaks: encryption applied only after the secrets already touched the unencrypted disk — rotate the data or reimage to be sure — swap left outside the container, and passphrase management. A passphrase nobody can recover converts a security feature into data loss on the next power cycle, so two-person custody is not overkill for anything that matters, and a passphrase written on the same disk is not custody at all.

With the disk locked, the remaining surface is not on the box at all: it is the panel that can reset the box, edit its DNS and read its traffic metadata. The strongest sshd_config on earth does not survive a weak hosting account, which is exactly where the next section goes.

The panel is attack surface too

The hosting panel resets boxes and edits DNS, which makes it attack surface no matter how clean the VM is. Enable 2FA on it the day you create the account, and treat its credentials with the same discipline as root. The no-KYC account model here — a token or an email plus a 12-character password — moves the entire identity burden onto that one credential, which is an argument for the token plus a password manager, not an argument against the model itself.

The mechanism is privilege concentration. Anyone holding panel access can rebuild the VM (your LUKS passphrase survives, the running state does not), repoint its DNS, and read connection metadata kept up to 24h. That is more operational power than a stolen SSH key carries, and it phishes better, because the email arrives looking like billing rather than like a security event — which is exactly why the second factor has to live on the panel account and not just on the box.

Recovery paths deserve the same audit as logins: whose mailboxes can reset the panel password, and do those mailboxes carry their own second factor? A token kept only in a password manager, with the manager itself behind 2FA and a paper copy in a drawer, survives scenarios that an emailed reset link does not. Map the chain once; the weak link is almost always the mailbox nobody remembered the panel could reach.

Where it breaks: shared panel logins on a team, no 2FA because 'the VM is hardened', and recovery addresses on a mailbox that itself has no second factor. Re-check panel access whenever the roster changes — departures are when this layer actually fails, and the audit takes five minutes if you do it before the departure rather than after.

Panel, keys, firewall, patches, backups, disk: six layers, all yours, none of them exotic. The seventh question — do you need antivirus — has a genuinely counter-intuitive answer for servers, because the base OS is almost never the infection path that matters, and knowing where scanning actually pays changes what you deploy it for.

Scan what you accept, not what you serve

Antivirus on a Linux server's base OS is mostly theater: distribution repositories sign their packages, and the usual infection path for a server is not a drive-by binary but content you accepted from other people. Where scanners earn their keep is uploads, mail spools and user-generated files — a ClamAV-class scanner on the intake directory, run on upload or on a schedule, catches the delivery layer of most commodity payloads before they are ever executed.

The mechanism is scoping. Scanning what crosses a trust boundary — users submitting files, mail arriving, archives unpacking — is defensible; scanning the OS hourly finds signed binaries and wastes the CPU that could have gone to the workload. If the box accepts uploads that other people's clients later download, intake scanning plus serving from a separate domain are the two moves that matter, and freshclam keeping signatures current in /var/lib/clamav is what makes the first one worth anything at all.

Placement follows the same boundary logic: keep the intake directory separate from anything that executes — /srv/uploads/ mounted with noexec and served from its own hostname is the minimum. Scanning finds payloads; separation leaves them inert, so a detection that arrives late still finds nothing runnable. Together the pair covers most commodity delivery chains — the kind that arrive daily and execute 0 times when the mount flags are right.

Where it breaks: quarantines nobody reviews — detection without response is decoration — scanner signatures that stopped updating in March, and scanning treated as a substitute for the boring layers. No scanner compensates for password authentication or an unpatched kernel, and the order of this checklist is the order of that sentence. Decide who reads the quarantine before you build the quarantine, or do not build it.

That is the full stack, and it decays: rosters change, services appear, the firewall list grows a port at a time. Hardening is not a state but a schedule — and the schedule, like the order of operations, is the part worth writing down. The next section is that writing, and the recap after it is the runnable version.

A checklist decays on a schedule

Steps one through nine are set-and-forget until the architecture changes; the decay lives in the remaining checks. Re-verify the backup restore quarterly, re-read the firewall after every new service, and re-check panel access whenever the roster changes. Order Core at $6/mo list — $4.80/mo annual-eff — as a throwaway rehearsal box and re-run this whole list against it before touching production; a rehearsal that costs $4.80/mo is a rehearsal that actually happens, which is the entire trick.

Snapshot the configuration itself while you are at it: nft list ruleset saved into a file under version control turns every change into a reviewable diff, and a ruleset nobody can diff is a ruleset nobody can audit. The same trick covers the sshd config and the crontab. Configuration that lives only in memory decays the moment the box does, and every incident shrinks into a 5-minute comparison when the before-and-after files exist.

The mechanism of decay is drift without a witness: a service added in May with a firewall hole, a sudo rule nobody remembers approving, a backup destination that quietly filled. Nothing alerts, because nothing is broken — until the day each of those becomes the incident, at which point all three are discoverable in the post-mortem and none of them were discoverable before it. The quarterly rehearsal is the witness, and it only works if it is cheap enough to survive a busy quarter.

Where re-verification breaks: it becomes a document nobody opens. Tie each recurring check to a trigger that still fires on its own — the calendar for restore rehearsals, the deploy checklist for firewall re-reads, the HR loop for panel access — and the schedule survives the person who wrote it, which is the only version of the schedule that matters over years rather than weeks.

Run the full sequence on any new box and you are past the failure modes that end most servers; run it quarterly on the oldest box and you stay there. The timeline below compresses everything on this page into the order the commands actually run, which is the form you will want open in a second terminal.

The hardening checklist, in the order to run it

Minute one: keys. ssh-keygen -t ed25519, the public half into ~/.ssh/authorized_keys, PasswordAuthentication no in /etc/ssh/sshd_config, a named sudo user for daily work, and a second terminal tested before the first one closes. The panel console stays open in a tab until the new session proves itself, because out-of-band access is what makes every later mistake in this list recoverable rather than fatal — and the 30-minute budget holds whether the target is production or a rehearsal box.

Minute five: firewall — default-deny, then 22/tcp, 80/tcp, 443/tcp and one port per real service, confirmed with ss -tulpn and nft list ruleset. Minute ten: fail2ban installed with an hour-scale bantime and your own addresses whitelisted, and unattended upgrades enabled from /etc/apt/apt.conf.d/50unattended-upgrades. Neither step needs a decision from you ever again, which is the point of doing both early.

Minute twenty: snapshots scheduled, an off-box copy flowing, and one restore rehearsed into a scratch directory so the chain is proven rather than assumed. Sensitive data goes into a LUKS container opened after boot, with the passphrase in custody somewhere other than the disk it protects. Day one evening: 2FA on the hosting panel, intake scanning on anything that accepts uploads, and the quarterly rehearsal in the calendar with a real reminder attached.

Ongoing, in the same order: /var/run/reboot-required weekly, firewall re-read after every new service, panel access re-checked at every roster change. None of it is clever, which is the point — keys, a short allow list, automatic patches, a tested restore, an encrypted disk, a two-factor panel. The order matters because each step shrinks the next one's risk, the schedule matters because every step drifts without one, and thirty minutes now plus a quarterly hour is the entire price of staying past the failure modes that end most servers.

Does VPSbit harden the server for me?

No — root is the product, which puts both the hardening decisions and their benefits in your hands. Nothing in the catalog pre-applies this checklist; it is the baseline a sysadmin would apply on any Linux box, and every step here runs in your session rather than the provider's, which is also why the skills transfer to any other server you will ever rent.

Is password login really unsafe by default?

It is the weak default on every public IP: brute-force attempts begin within minutes of first boot and never stop, because scanning the whole IPv4 space is cheap for botnets. Key-only authentication is the highest-value single step on this page — do it before the firewall and before updates, and keep the panel console open while you flip the setting so a typo stays recoverable.

Do I need antivirus on a Linux VPS?

Rarely for the base OS, which is not the usual infection path on a signed-repository distribution. Scan what you accept from others instead: uploads, mail spools and user-generated files, where a ClamAV-class scanner on the intake directory catches what actually arrives. Detection without someone reading the quarantine is decoration, so decide who reviews before you deploy.

How often should the checklist be re-run?

Steps one through nine hold until the architecture changes. Rehearse the backup restore quarterly, re-read the firewall after every new service, and re-check panel access whenever the roster changes — each check tied to a trigger that fires on its own rather than to memory, because memory is the first thing a busy quarter deletes.

Can I use LUKS on a VPS, or only on dedicated?

Both. On a VPS the provider console plays the boot-time passphrase role; on the dedicated tiers IPMI provides a full remote console and virtual media, which makes post-boot unlocks routine even for unattended reboots. The pattern — container opened after boot, key custody off-disk, swap inside the container — is identical either way.

What is the fastest way to lose all of this?

An unguarded hosting panel: it can rebuild the box, repoint DNS and outlast every control inside the VM. Enable 2FA the day the account is created, keep recovery off any mailbox that lacks its own second factor, and re-audit panel access whenever a teammate leaves — departures are when this layer fails in practice.

Primary sources

More ways to pay

Pay with Bitcoin · Pay with Monero · Pay with USDT (TRC-20/ERC-20/SPL) · Pay with Litecoin · Pay with Ethereum · Pay with Solana · Pay with x402 · Pay with Dogecoin · Pay with XRP · Pay with TRX · Monero on bare metal · Dedicated servers with crypto · Pick the jurisdiction first.

Ready to launch?

Build the box — VPS or bare metal — create the password, pay the invoice that follows.