basforge

Search titles, text and the “If it doesn’t work” cases.

    RU
    Topic · Linux

    Ubuntu server

    The first hour on a new server, updates, everyday commands

    Entries
    10
    Cases
    46
    Updated
    2026-11-13
    Series · where to startOverview

    A new Ubuntu server: what to set up in the first hour and why

    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 overview
    1. First login · ManualFirst login to a server: updates, hostname, a sudo user, key loginUpdates, hostname, time zone, your own sudo user with a key, key-only login. The first 20 minutes.
    2. Firewall · Manualfrom FirewallThe ufw firewall: everything closed except SSH and webufw: everything closed except SSH and web — and why it doesn’t close Docker’s ports.
    3. Auto-updates · Configunattended-upgrades: security updates on their own and a reboot at 4:00unattended-upgrades block by block: what installs itself, when the server reboots, and how to check.
    4. Swap, journal, time · ManualSwap, journal and time: three settings for a small VPSThree settings for a small VPS: a swap file, a journal size limit, clock sync.
    5. Docker · Manualfrom Docker EngineDocker on Ubuntu: from Docker’s repository, with a log limitFrom Docker’s repository, not snap, with container log rotation. Before the bans: CrowdSec runs in a container.
    6. Brute-force bans · Manualfrom CrowdSecCrowdSec against SSH brute force: a ban across the whole serverCrowdSec reads auth.log and bans addresses that guess logins, across the whole server.
    7. Cheat sheet · Cheat sheetAn Ubuntu server: everyday commandsServices, journal, packages, disk, network — everyday commands.
    8. cloud-init · Configcloud-init: a server configured the moment it’s createdThe same as a file at server creation: user, key, packages, firewall.

    More in this topic

    Tips

    6