First steps on your own VPS: SSH and firewall
Updated: 12 August 2026 · Guide · VPS · Beginner
After ordering you get an email with the IP address and root password. The first contact is via SSH:
ssh root@YOUR-IP
Working as root all the time is not a good idea; one typo at the wrong moment is enough. So create your own user with sudo rights straight away:
adduser <username> usermod -aG sudo <username>
From here an SSH key is worth it instead of a password. Generate a key pair on your own computer and copy it to the server:
ssh-keygen -t ed25519 ssh-copy-id <username>@YOUR-IP
Then set PasswordAuthentication to no and PermitRootLogin to no in /etc/ssh/sshd_config, and reload the SSH service:
sudo systemctl reload sshd
Firewall
ufw installs quickly on Debian and turns a handful of commands into a working firewall. The order matters: allow SSH first, then switch it on, otherwise you lock yourself out.
sudo apt install ufw sudo ufw allow OpenSSH sudo ufw enable
Every further service gets its own rule when it's needed: a web server ports 80/443, a Minecraft server 25565, a TS3 server its three ports. Everything else stays closed.
This is the basis for the other guides here: your own website, Minecraft, Discord bot, TeamSpeak. Each of them assumes SSH access and the firewall are already set up like this.
The most common mistake
Locking yourself out. If you switch off PasswordAuthentication before the SSH key is proven to work, you can't get back in, and a VPS has no keyboard you could sit down at. The safe order is therefore always: upload the key, open a SECOND SSH session in parallel and test the key login with it, and only once that works switch off password login in the first session. The old session stays open and is your way back if something goes wrong.
The same goes for the firewall: allow OpenSSH first, then switch it on. The other way round, ufw cuts the running connection in the middle of the command.
Automatic security updates
A server nobody updates inevitably becomes vulnerable over time, not through a targeted attack but through automated scanners probing for known holes. Debian and Ubuntu ship a package that installs security updates without you doing anything:
sudo apt install unattended-upgrades sudo dpkg-reconfigure --priority=low unattended-upgrades
This covers security updates, not operating system version upgrades. Rebooting after kernel updates remains your decision.
Slowing down login attempts
As soon as a server is publicly reachable, strangers' login attempts hit port 22 constantly. With key login instead of a password they are practically hopeless, but they fill the log and cost CPU time. fail2ban automatically bans suspicious IP addresses after several failed attempts:
sudo apt install fail2ban sudo systemctl enable --now fail2ban sudo fail2ban-client status sshd
Check what is actually open
A firewall only helps against what it knows about. The honest check therefore looks at the services that are really listening, not at the rule list but at the server itself:
sudo ss -tulpn sudo ufw status verbose
Anything listening on 0.0.0.0 here without a reason should either be switched off or bound to 127.0.0.1. A database that only your own application needs doesn't have to be reachable from the internet. This is the most common reason an otherwise cleanly set up server still gets taken over.
Everything above is one-off work of about half an hour and routine after that.
If you don't want to maintain a server at all
But if you only want to run a game server or a Discord bot, you don't need this groundwork: with our ready-made products we take care of the operating system, hardening and updates, and you only see the control panel.
- Next: your own websitenginx, domain, HTTPS
- Next: Discord botRunning permanently with systemd
- Next: TeamSpeak 3Voice server on the same VPS
- View VPS plansAll tiers with real figures
- Configure your own VPSChoose RAM, cores and storage freely
- Game server without your own serverPreconfigured, no SSH