DEV Community

Faruk
Faruk

Posted on • Originally published at Medium

5 Linux Hardening Techniques I Apply Before Hosting Any Website | by Faruk Ahmed | Apr, 2025

Member-only story

5 Linux Hardening Techniques I Apply Before Hosting Any Website

--

Share

(After this topic, read “5 More Techniques to Lock Down Public-Facing Linux Servers”)

✍️ Full Blog Content:

Intro:

Hosting a website on Linux isn’t just about setting up Apache or Nginx — it’s about making sure your server doesn’t get turned into someone else’s playground. Over the years, I developed a personal checklist: five hardening techniques I apply every single time before a site goes live.

If you skip these, you’re inviting trouble.

1. Move SSH to a Non-Standard Port and Harden Config

Attackers scan port 22 constantly. One of the first things I do:

✅ Steps:

sudo nano /etc/ssh/sshd_config
Enter fullscreen mode Exit fullscreen mode
  • Change port to something like 2210
  • set

PermitRootLogin no PasswordAuthentication no AllowUsers youradminuser

✅ Restart SSH:

sudo systemctl restart sshd
Enter fullscreen mode Exit fullscreen mode

🔒 Bonus Tip: Whitelist your IP range in firewall rules if possible.

2. Enable Web Server Hardening Modules


👉 Read Full Blog on Medium Here

AWS Security LIVE! Stream

Streaming live from AWS re:Inforce

What’s next in cybersecurity? Find out live from re:Inforce on Security LIVE!

Learn More

Top comments (0)

AWS Security LIVE! Stream

Streaming live from AWS re:Inforce

Tune into Security LIVE! at re:Inforce for expert takes on modern security challenges.

Learn More