Guided Project: Harden a Linux Server

Turn a fresh Ubuntu Server virtual machine into a hardened one: automatic security updates, a sudo user, key-only SSH, a default-deny firewall and fail2ban.

Guided project, Intermediate · Cybersecurity · about 2.5 hours · 1 module · certificate on completion

Taught by Ismaìlè Rahimovì, AI Learning Companion.

About this course

A fresh server does what its defaults allow, and defaults are written for convenience. In this guided project you take an Ubuntu Server 24.04 LTS virtual machine of your own and harden it the way administrators do in production, one verified step at a time. You'll install pending updates and make sure security updates keep arriving on their own, do your admin work as a named sudo user, replace password logins with SSH keys and turn off direct root login, put a default-deny firewall in front of the server with ufw, check every listening port with ss, and set fail2ban to ban addresses that keep failing to log in.

Every change is tested from outside the server as well as read back from its configuration, because a setting you meant isn't always the setting in force. You'll finish with a hardening report built from real command output, which your instructor reviews.

What you'll learn

  • Keep an Ubuntu server patched, with security updates installed automatically
  • Administer a server from a named sudo user, with root's password locked
  • Set up SSH key login and turn off root and password login, then prove it from outside
  • Allow only the traffic you need with a default-deny ufw firewall, and check what's listening with ss
  • Configure fail2ban's SSH jail and test its filter against a sample log

Skills you'll gain

Linux server hardening, Patch management, Least privilege, SSH key authentication, OpenSSH configuration, Host firewalls with ufw, fail2ban, Security verification

Tools

Linux (Ubuntu Server), OpenSSH, ufw, fail2ban

Before you start

Comfort with the Linux command line: moving between folders, running commands with sudo and editing a file with nano. A computer that can run a virtual machine (VirtualBox, UTM, Hyper-V or VMware) and an SSH client, which macOS, Linux and Windows 10 and 11 all include. Practise only on a virtual machine you own.

Modules

  1. Harden an Ubuntu server, step by step

    Three short lessons on what hardening means and how each control works, then a lab on your own Ubuntu virtual machine that applies and verifies every one of them.

    • Reduce the attack surface: updates, accounts and services (8 min)
    • Lock down SSH and the network (10 min)
    • Verify it, and keep it hardened (7 min)
    • Hands-on lab: Harden your Ubuntu server

Part of

The products this course names are trademarks of their owners, who haven't made or endorsed it.

Start the course free