24 Nov 2026
The first hour on a new VPS: 8 steps to make it safe
Bots start knocking on a new server within minutes. A simple, beginner-friendly checklist to lock down a fresh Linux VPS.
The moment your VPS gets a public IP address, automated bots start trying passwords. This checklist takes about an hour and stops almost all of them. The commands are for Debian and Ubuntu.
1. Update everything
apt update && apt upgrade -y
Old packages are the easiest way in. Do this first, then reboot if the kernel was updated.
2. Create a normal user
Never work as root every day.
adduser alex
usermod -aG sudo alex
3. Log in with SSH keys, not passwords
On your own computer create a key (ssh-keygen -t ed25519) and copy it to the server with ssh-copy-id alex@your-server-ip. Test that you can log in before the next step.
4. Turn off password and root login
In /etc/ssh/sshd_config set:
PasswordAuthentication no
PermitRootLogin no
Then restart SSH: systemctl restart ssh. Keep your current session open until you have tested a new login.
5. Turn on a firewall
ufw allow OpenSSH
ufw allow 80,443/tcp
ufw enable
Only open the ports you really use.
6. Ban repeat offenders
Install fail2ban. Its default settings already block IP addresses that fail to log in many times.
7. Automatic security updates
apt install unattended-upgrades
dpkg-reconfigure -plow unattended-upgrades
8. Backups before you need them
Use your provider's snapshot feature and keep at least one copy somewhere else. Read our 3-2-1 backup guide for a simple plan.
Next steps
Point a domain at the server (compare domain prices), install a web server and get a free HTTPS certificate. If you haven't picked a server yet, start with VPS offers.