Guide

Harden a new VPS in one command (beta)

Last updated: 3 December 2026

This free script does the three things most people should do on a new server: a normal sudo user, SSH without passwords and a firewall. It is new (beta): read it first and try DRY_RUN=1.

Instant VPS from $7.99 a month

See Instant VPS plansHow ordering works

Requirements and run

Ubuntu 22.04/24.04 or Debian 12/13 with root access, at any provider. Download, compare the SHA-256 (430e8d41d3f58b54f491dd0d0d54bd538a0b95e31389c8129e7c73f741998f10), read it, then run:

wget https://phantomvps.com/blog/harden.sh
sha256sum harden.sh
less harden.sh
sudo NEW_USER=alice bash harden.sh

What it changes

Good to know

Where to run it

Need a server? See our Instant VPS plans: no ID documents, pay with Monero or Bitcoin. Use them within our acceptable use policy.

Questions and answers

How do I undo it?
Delete /etc/ssh/sshd_config.d/00-phantom-hardening.conf, reload ssh and run ufw disable.

Will it lock me out?
It changes SSH only when a key is installed and checks the new settings with sshd -t first. Still, test a new login before closing your session.

Is it tested?
It is a beta. Please report problems to support@phantomvps.com.

Does it work on other providers?
Yes, on any server with a supported system and root access.

Related guides

Ready to try it? Instant VPS from $7.99 a month

See Instant VPS plansHow ordering works