Linux server hardening checklist
A new VPS with a public address gets its first SSH password guesses within minutes. Most break-ins on small servers still come from the same few gaps: password logins, missing updates, a forgotten service listening on the internet, and nobody reading the logs. This checklist closes them in the order that matters most.
1. SSH
- Keys only. Set PasswordAuthentication no and KbdInteractiveAuthentication no in sshd_config, after you have confirmed your key works in a second session.
- No root login. PermitRootLogin no (or prohibit-password if automation needs it); log in as a named user and use sudo.
- Check what sshd actually uses. sudo sshd -T prints the merged settings, including files in sshd_config.d that can override yours.
- Rate-limit guesses. fail2ban or CrowdSec keeps logs readable and slows guessing, though with keys only the guesses cannot succeed.
2. Updates
- Security updates automatically. unattended-upgrades on Debian and Ubuntu, dnf-automatic on RHEL and Fedora.
- Reboot when the kernel or libc changes. An update is only applied once the running process uses it; check for a pending reboot after upgrades.
- Know what is installed. Remove packages and language runtimes you do not use; every one is something to patch.
3. Network
- Default-deny firewall. Allow SSH, and only the ports your services need, with ufw, firewalld or nftables.
- List what is listening. sudo ss -tlnp shows every listening port and the program behind it. Databases, caches and admin panels should listen on localhost or a private network, not on 0.0.0.0.
- Remember Docker. Ports published by Docker bypass ufw's rules by default; bind them to 127.0.0.1 or put a reverse proxy in front.
4. Users and permissions
- One account per person, no shared logins, and remove accounts when people leave.
- Review sudo access in /etc/sudoers and /etc/sudoers.d.
- Run services as their own users, never as root unless they must, and keep web roots unwritable by the web server where you can.
5. Logs and monitoring
- Keep logs off the box too. An intruder with root can edit local logs.
- Watch for change. New users, new SSH keys, new cron entries and systemd units, new listening ports and changed system files are the common signs of a break-in.
- Make sure someone sees it. A check that writes to a file nobody reads protects nothing; alerts should reach a person, and only for things that need one.
Measure it
The CIS Benchmarks are the standard detailed checklist for each distribution, with Level 1 for settings that rarely break anything and Level 2 for stricter ones. Score a server before and after a hardening session so you can see what changed.
Where Vigilhold fits
Vigilhold is a hosted security agent for Linux servers and Docker hosts. It reports SSH settings, listening ports, known vulnerabilities in installed packages and pending reboots, scores CIS Level 1 and 2 from what it sees, and watches for changes like those in step 5 as they happen. It responds only within limits you set and asks a person before changing SSH settings.
Checked in November 2026: OpenBSD sshd_config manual, Debian wiki: UnattendedUpgrades, CIS Benchmarks, Docker docs: Docker and ufw.
Vigilhold vs fail2ban · Vigilhold vs CrowdSec · Vigilhold vs Wazuh · Start a 14-day free trial