Member-only story
How I Harden My Linux Server in 30 Minutes After Every Fresh Install (Ubuntu & Red Hat)
--
5
Share
Intro: Whether it’s a VM, a fresh cloud server, or a bare-metal deployment — your new Linux server is a blank slate and a target. Before deploying anything, I now follow a fast but effective checklist to lock it down within 30 minutes. In this post, I’ll walk through my routine step-by-step.
1. Update and Upgrade Everything
# Ubuntusudo apt update && sudo apt upgrade -y
# Red Hatsudo dnf update -y
✅ Why? Exploits often target unpatched services. Always start clean.
2. Create a New Admin User (Never Use Root)
sudo adduser adminusersudo usermod -aG sudo adminuser # Ubuntusudo usermod -aG wheel adminuser # Red Hat
✅ Then disable direct root SSH access.
sudo nano /etc/ssh/sshd_config# Set:PermitRootLogin no
3. Enable Automatic Security Updates
Ubuntu:
sudo apt install unattended-upgradessudo dpkg-reconfigure --priority=low unattended-upgrades
Red Hat (with dnf-automatic):
sudo dnf install…