A security checklist for a new server
A freshly created server starts getting scanned within minutes. Here's what's worth doing in the first hour to close the obvious risks.
Eight steps
- Update the system:
apt update && apt upgrade. - Create a separate sudo user; don't work as root.
- Key-only login; disable password login.
- Change the access port if you like and enable the firewall.
- Leave only the ports you need open.
- Install fail2ban against brute force.
- Turn on automatic security updates.
- Set up backups before there's important data.
A firewall in a couple of commands
ufw default deny incoming
ufw default allow outgoing
ufw allow 22/tcp
ufw allow 80,443/tcp
ufw enable
Next
These steps close the most obvious gaps. After that comes monitoring, regular updates and testing backups. Security isn't a one-time setup but a habit of coming back and checking.