Linux Hardening Fundamentals
Secure a fresh Ubuntu server from scratch — configure SSH, set up firewalls, manage users, and eliminate attack surface.
01 Overview
In this mission you'll take a freshly provisioned Ubuntu 22.04 server and harden it against common attack vectors. You'll disable unnecessary services, configure secure SSH access with key-based authentication, set up a stateful firewall with UFW, enforce strong password policies, and enable audit logging. By the end you'll have a repeatable hardening checklist you can apply to any Linux system.
02 Environment Setup
**Option 1 — Local VM (free):** Download [VirtualBox](https://www.virtualbox.org/) and the [Ubuntu 22.04 Server ISO](https://ubuntu.com/download/server). Create a new VM with 2GB RAM and 20GB disk, then install Ubuntu. **Option 2 — Cloud VPS (easiest):** Spin up a free-tier EC2 instance on AWS (t2.micro, Ubuntu 22.04) or a $4/month DigitalOcean Droplet. You'll get SSH access immediately. Once you have access, SSH in and run `sudo apt update && sudo apt upgrade -y` before starting.
03 Mission Tasks
Run a baseline security audit using lynis. Document open ports, running services, and current user accounts.
Disable root login, enforce key-based authentication only, change the default port, and configure fail2ban to block brute-force attempts.
Install and configure UFW. Define an allow-list of required ports (SSH, HTTP, HTTPS) and deny everything else by default.
Create a non-root admin user, configure sudo access with least privilege, and audit file permissions on sensitive directories.
Configure auditd to track privilege escalation, file access on /etc, and login events. Export logs to a centralised location.
04 Why This Matters
Linux hardening is a foundational skill for SOC analysts, cloud security engineers, and DevSecOps engineers. Most cloud workloads run on Linux — knowing how to secure them is non-negotiable.
You'll Need
- A Linux VM or cloud VPS (Ubuntu 22.04 recommended)
- SSH access with sudo privileges
- Basic command line familiarity (ls, cd, nano/vim)
- A terminal on your local machine
Tools & Tech Stack
Skills You'll Gain
- Linux administration
- Firewall configuration
- SSH security
- Audit logging
- Least-privilege principles
More Missions
Docker Security Lab
Scan container images for CVEs, build minimal secure images, and enforce runtime security policies across a multi-container stack.
Cloud Security Audit with AWS
Audit a misconfigured AWS environment — find exposed S3 buckets, overly permissive IAM roles, open security groups, and missing CloudTrail.
Automated Threat Detection Pipeline
Build a SIEM-style detection pipeline using Python and the ELK stack to ingest logs, detect anomalies, and trigger automated alerts.