跳至主要内容

Secure a New Linux VPS in 15 Minutes (Ubuntu)

A checklist for the first minutes on a new Linux VPS — automatic updates, a sudo user, SSH keys, no root or password login, a firewall and backups.

Published Updated 3 min read

Illustration of a cloud server with a shield, key, padlock and a terminal window showing a checkmark
On this page
  1. 1. Keep it updated
  2. 2. Work as your own user, not root
  3. 3. Use SSH keys instead of passwords
  4. 4. Disable root and password logins over SSH
  5. 5. Turn on the firewall and open only what you use
  6. 6. Install Fail2ban
  7. Don’t skip this: plan your backups
  8. The checklist

Within minutes of your VPS coming online, bots will start guessing its SSH password. Nobody is targeting you; they scan every IP address on the internet, all the time. This is a six-step checklist to finish before you install anything else. It takes about 15 minutes on Ubuntu (Rocky Linux is similar — use dnf and firewalld instead).

1. Keep it updated

A Sundae VPS is fully updated when it’s handed over. Turn on automatic security updates so it stays patched when you forget:

sudo apt install -y unattended-upgrades
sudo dpkg-reconfigure --priority=low unattended-upgrades

2. Work as your own user, not root

Working as root all the time means one mistyped command can break the whole system. A Sundae VPS already logs you in as the user you chose when ordering, not root. Check that it has sudo:

sudo -v

On a server from elsewhere that only gives you root, create a user first with adduser your-username and usermod -aG sudo your-username.

3. Use SSH keys instead of passwords

An SSH key can’t be guessed the way a password can. On your own computer (not the VPS), create a key and copy it to the server:

ssh-keygen -t ed25519 -C "you@example.com"
ssh-copy-id your-username@YOUR_VPS_IP

If you pasted a public key when ordering, it’s already installed; skip straight to the test. Open a new terminal and run ssh your-username@YOUR_VPS_IP. If you get in without a password prompt, the key works.

4. Disable root and password logins over SSH

Once key login works, add a small config file. Name it starting with 00-: SSH keeps the first value it reads for each setting, and other files in the same folder (such as 50-cloud-init.conf) may turn password login back on.

sudo nano /etc/ssh/sshd_config.d/00-hardening.conf

with these two lines:

PermitRootLogin no
PasswordAuthentication no

restart SSH (on Rocky Linux the service is sshd):

sudo systemctl restart ssh

and check that it took effect. Both lines should end in no:

sudo sshd -T | grep -Ei 'permitrootlogin|passwordauthentication'

5. Turn on the firewall and open only what you use

The rule is deny everything, then allow what you need. On Ubuntu that’s ufw:

sudo ufw allow OpenSSH
sudo ufw allow 80,443/tcp   # if this is a web server
sudo ufw enable
sudo ufw status

Always allow OpenSSH before ufw enable, or you will cut yourself off. DDoS traffic is already filtered at the network edge before it reaches the server; the on-server firewall decides which of your services are exposed at all.

6. Install Fail2ban

Fail2ban watches the logs and bans IPs that keep failing to log in. The defaults already protect SSH:

sudo apt install -y fail2ban
sudo systemctl enable --now fail2ban
sudo fail2ban-client status sshd

Don’t skip this: plan your backups

The most important step, and the one most often skipped. RAID storage covers a failed drive, but not a deleted file, a botched update or a compromise — and Sundae VPS does not take automatic backups for you. Set up off-server backups on day one, for example:

  • restic or borg pushing to object storage
  • A daily cron job that dumps your database and ships it elsewhere
  • An actual test restore, at least once. A backup you have never restored is not a backup yet.

The checklist

  • Automatic security updates on
  • Logged in as your own sudo user, not root
  • SSH keys only; root and password login disabled
  • ufw enabled with only the ports you use
  • Fail2ban installed
  • Off-server backups running, and a restore tested

With these six done, your server is already better protected than most machines on the internet. Now go install your web server, Docker or whatever you came here to run.

Frequently asked questions

Should I move SSH off port 22?

It isn't necessary. A different port cuts log noise from scanning bots, but what actually protects the server is key-based login with password authentication turned off.

What if a firewall mistake locks me out of SSH?

Open the Web Console (VNC) from the control panel. It reaches the server without going over the network, so you can fix the firewall rules or SSH settings from there.

Does the VPS come with backups?

Not at Sundae VPS — there are no automatic backups or snapshots. RAID protects against a failed drive, not against deleted files, so off-server backups are the customer's responsibility.

Back to articles