Ubuntu server
The first hour on a new server, updates, everyday commands
The first hour on a new server, updates, everyday commands
A fresh VPS comes with root, port 22 open and packages as old as the image — bots start guessing the password minutes after boot. The order: access, updates, firewall, system, Docker, brute-force bans. The base is Ubuntu 24.04 LTS; where 26.04 behaves differently, it says so next to it.
Read the overviewsudo user with a key, key-only login. The first 20 minutes.auth.log and bans addresses that guess logins, across the whole server.zram-tools package creates /dev/zram0 — swap that lives in memory itself, compressed 2–3 times. It suits a small VPS with a slow disk or a write limit. The whole config is four lines in /etc/default/zramswap, and their defaults differ between Ubuntu 24.04 and 26.04.systemd only take effect after a reboot — until then the server runs the old code with its holes open.from SSHEditing sshd or the firewall? Keep the old session openBefore you touch sshd_config, AllowUsers, the port or ufw rules, keep the current SSH session open and test the login from a second window.from SSHMoving off port 22 cuts log noise but doesn’t protect youBots guess passwords on port 22; far fewer show up on another port.from FirewallDocker ports bypass the input chainA firewall rule in input doesn’t touch containers with published ports: after DNAT their traffic goes through forward.from Server changesTest your server’s protection by actionTest protection by doing: ban your own address and see that the site doesn’t open.