Skip to content
Back to Blog
Security10 min read

Server Security Hardening Checklist: 8 Steps for 2026

Lock down your Linux or Windows server with this eight-step hardening checklist covering SSH, firewalls, automatic updates, and intrusion detection.

Written by Abdul AbrorTechnical Hosting Support Engineer
Server Security Hardening Checklist: 8 Steps for 2026
On this page

Every unpatched server is a future support ticket. I've cleaned up after breaches that started with default SSH ports and root logins—simple mistakes that turn expensive fast. This checklist walks you through eight hardening steps that stop the most common attack vectors on Linux and Windows servers.

You don't need a security degree. You need a systematic approach and thirty minutes per server.

Step 1: Disable Root Login and Use SSH Keys

Password authentication over SSH is the front door attackers try first. Brute-force bots scan port 22 around the clock, testing common usernames and passwords.

Switch to key-based authentication and lock out root entirely.

On your local machine, generate an SSH key pair if you haven't already:

ssh-keygen -t ed25519 -C "[email protected]"

Copy the public key to your server:

ssh-copy-id username@your-server-ip

Test the key login, then edit /etc/ssh/sshd_config on the server:

PermitRootLogin no
PasswordAuthentication no
PubkeyAuthentication yes

Restart SSH to apply:

sudo systemctl restart sshd

For Windows Server running OpenSSH, the configuration file lives at C:\ProgramData\ssh\sshd_config and the same directives apply. Restart the sshd service through Services or PowerShell.

One more thing: change the default SSH port from 22 to something higher, like 2222 or 49152. It won't stop a determined attacker, but it cuts noise from automated scans by ninety percent. Add Port 2222 to your sshd_config and update your firewall rules to match.

Step 2: Configure a Host Firewall

Open ports are open invitations. A fresh VPS often ships with every port exposed, which means services you forgot about become attack surfaces.

Linux systems use ufw (Uncomplicated Firewall) or firewalld. I prefer ufw for its clarity.

Install and enable it:

sudo apt install ufw
sudo ufw default deny incoming
sudo ufw default allow outgoing
sudo ufw allow 2222/tcp  # your SSH port
sudo ufw allow 80/tcp
sudo ufw allow 443/tcp
sudo ufw enable

Check the active rules:

sudo ufw status numbered

For firewalld on CentOS or RHEL:

sudo firewall-cmd --permanent --add-service=ssh
sudo firewall-cmd --permanent --add-service=http
sudo firewall-cmd --permanent --add-service=https
sudo firewall-cmd --reload

Windows Server uses Windows Defender Firewall. Open it from Administrative Tools, click Inbound Rules, and create rules for your necessary ports. Default is to block everything inbound; allow only what you need.

Deny everything by default, allow specific services. That's the rule.

Step 3: Enable Automatic Security Updates

Patching is boring until an exploit drops. The fastest way to fall behind is manual updates you keep putting off.

Automate them.

On Debian and Ubuntu, install unattended-upgrades:

sudo apt install unattended-upgrades
sudo dpkg-reconfigure --priority=low unattended-upgrades

Edit /etc/apt/apt.conf.d/50unattended-upgrades to control what gets updated. Security updates should auto-install; kernel and application updates you might want to stage manually depending on your uptime requirements.

For RHEL-based systems, dnf-automatic does the job:

sudo dnf install dnf-automatic
sudo systemctl enable --now dnf-automatic.timer

Configure /etc/dnf/automatic.conf to set apply_updates = yes for automatic application.

Windows Server has automatic updates built in. Open Settings > Update & Security > Windows Update > Advanced options, and configure the active hours and automatic restart behavior. For production servers, you might prefer Windows Server Update Services (WSUS) to control the rollout, but for a single VPS, the built-in scheduler is enough.

Automatic patching isn't reckless if you monitor logs and have backups. It's reckless not to patch at all.

Step 4: Install and Configure Fail2Ban

Fail2Ban watches your logs for repeated failed login attempts and bans the offending IP addresses temporarily. It's a second line of defense after key-based auth.

Install it:

sudo apt install fail2ban

Copy the default config to a local override:

sudo cp /etc/fail2ban/jail.conf /etc/fail2ban/jail.local

Edit /etc/fail2ban/jail.local and ensure the [sshd] section is enabled:

[sshd]
enabled = true
port = 2222
logpath = /var/log/auth.log
maxretry = 3
bantime = 3600

Restart the service:

sudo systemctl restart fail2ban
sudo systemctl enable fail2ban

Check banned IPs:

sudo fail2ban-client status sshd

Fail2Ban can also protect other services like Apache, Nginx, and Postfix by monitoring their respective logs. Each service gets its own jail configuration.

Windows doesn't have a direct Fail2Ban equivalent, but you can achieve similar results with PowerShell scripts that parse Event Viewer logs and create firewall rules dynamically. Third-party tools like EvlWatcher exist, but they're less common in production.

Step 5: Disable Unnecessary Services

Every running service is a potential entry point. A default Linux install might start Avahi, CUPS, or Bluetooth daemons you'll never use on a headless server.

List all active services:

sudo systemctl list-units --type=service --state=running

Disable anything you don't recognize or need:

sudo systemctl disable --now avahi-daemon
sudo systemctl disable --now cups

On Windows, open Services (services.msc) and set unused services to Manual or Disabled. Common candidates: Print Spooler, Remote Registry, Windows Search.

If you're not printing from the server, the Print Spooler service is dead weight. Remote Registry is a support shortcut that's also a security risk.

Less surface area means fewer things to patch and fewer places for an attacker to poke.

Step 6: Set Up Intrusion Detection with AIDE or Tripwire

Intrusion detection systems (IDS) watch for unauthorized changes to system files. AIDE (Advanced Intrusion Detection Environment) creates a baseline snapshot of file hashes and alerts you when something changes.

Install AIDE:

sudo apt install aide

Initialize the database (this takes a few minutes):

sudo aideinit

Move the new database into place:

sudo mv /var/lib/aide/aide.db.new /var/lib/aide/aide.db

Run a check:

sudo aide --check

Schedule daily checks with a cron job:

sudo crontab -e

Add:

0 3 * * * /usr/bin/aide --check | mail -s "AIDE Report" [email protected]

AIDE will email you when critical files like /etc/passwd or /bin/bash are modified. False positives happen after legitimate updates, so you'll need to update the baseline after patching:

sudo aide --update
sudo mv /var/lib/aide/aide.db.new /var/lib/aide/aide.db

Tripwire is a commercial alternative with more features, but AIDE covers the essentials for free.

For Windows, File Integrity Monitoring is available through Group Policy or third-party tools like OSSEC. PowerShell scripts can also hash critical directories and alert on changes.

Step 7: Harden Kernel Parameters with sysctl

The Linux kernel exposes dozens of tunable parameters that affect network security. A few tweaks can mitigate SYN floods, IP spoofing, and ICMP attacks.

Edit /etc/sysctl.conf or create a new file under /etc/sysctl.d/99-hardening.conf:

# Ignore ICMP redirects
net.ipv4.conf.all.accept_redirects = 0
net.ipv6.conf.all.accept_redirects = 0

# Ignore source-routed packets
net.ipv4.conf.all.accept_source_route = 0
net.ipv6.conf.all.accept_source_route = 0

# Enable SYN cookies for SYN flood protection
net.ipv4.tcp_syncookies = 1

# Log suspicious packets
net.ipv4.conf.all.log_martians = 1

# Disable IP forwarding if not routing
net.ipv4.ip_forward = 0
net.ipv6.conf.all.forwarding = 0

Apply the changes:

sudo sysctl -p

These settings won't break normal traffic, but they close common network-layer attack vectors. You can verify current values with:

sysctl net.ipv4.tcp_syncookies

Windows handles most of this through the TCP/IP stack settings and firewall. SYN attack protection is enabled by default in modern versions, but you can tune parameters via registry keys under HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters if needed.

Step 8: Enable Centralized Logging and Monitoring

You can't fix what you don't see. Centralized logging aggregates security events from all your servers into one place, making pattern recognition possible.

For small setups, ship logs to a remote syslog server. Configure rsyslog on each client:

Edit /etc/rsyslog.conf and add:

*.* @your-log-server-ip:514

For TCP (more reliable):

*.* @@your-log-server-ip:514

Restart rsyslog:

sudo systemctl restart rsyslog

On the log server, configure rsyslog to accept remote logs by uncommenting the UDP or TCP listener lines in /etc/rsyslog.conf.

For larger environments, the ELK stack (Elasticsearch, Logstash, Kibana) or Graylog provide search, visualization, and alerting. Installation is beyond this checklist, but the concept is the same: aggregate, index, alert.

Windows Event Forwarding (WEF) lets you forward Event Viewer logs to a collector server. Configure it through Group Policy or PowerShell, and use Windows Admin Center or third-party SIEM tools to analyze events.

Monitor at minimum: failed SSH attempts, sudo usage, file changes in /etc, service restarts, and firewall denials. Set up alerts for anomalies like login attempts outside business hours or repeated denials from the same IP.

What to tackle first

Start with steps one and two—SSH keys and firewall rules. They take ten minutes and block the noisiest attack vectors immediately.

Automatic patching (step three) comes next because unpatched systems get compromised faster than anything else. The rest of the checklist builds layers: intrusion detection, kernel hardening, and logging give you visibility and resilience after the perimeter is locked down.

Hardening isn't a one-time checklist. New vulnerabilities appear, configurations drift, and services get added. Schedule a quarterly review to audit open ports, review firewall rules, and rotate SSH keys. Treat it like backups—essential, recurring, and worth the time.

FAQ

How often should I update the AIDE baseline?
After every legitimate system update or configuration change. Otherwise, you'll get false positives on every check. Some teams script this as part of their patching workflow.

Do I really need to change the SSH port?
No, it's security through obscurity and won't stop a targeted attack. But it does cut log noise from bots by ninety percent, which makes real threats easier to spot. Your call.

Can I automate kernel updates safely?
Kernel updates often require a reboot. For production servers, stage them manually or use a maintenance window. For dev/staging, auto-install is fine. Configure unattended-upgrades to exclude kernels if you want control.

What's the difference between host firewalls and network firewalls?
Host firewalls (ufw, firewalld, Windows Firewall) run on each server and filter traffic at the OS level. Network firewalls sit upstream and filter traffic for multiple machines. You want both—defense in depth.

Is Fail2Ban enough to stop brute-force attacks?
It helps, but SSH keys are the real fix. Fail2Ban slows down attackers and reduces log spam. Keys eliminate the attack vector entirely.

Locking down the perimeter

Eight steps, one afternoon, and your server moves from a soft target to a hardened host. None of this is optional for production systems exposed to the internet. Start with SSH and firewalls, layer in automatic patching and intrusion detection, and you'll catch most attacks before they escalate.

The servers I've seen breached all skipped at least three of these steps. Don't be that ticket.