Member-only story
Why I Always Disable Unused Services on Linux Servers
--
Share
When I take over a new Linux server, one of the first things I do is check which services are running . Why? Because every service left running is another potential door for attackers .
Here’s why disabling unused services is one of the fastest wins in hardening — and how I do it step by step.
🚨 The Risks of Leaving Services Running
- Increased Attack Surface An open port means someone can knock on it. Even if the service isn’t vulnerable today, it could be tomorrow.
- Privilege Escalation Paths Services running as root can become a direct route to full system compromise.
root
- Resource Drain Unused daemons eat CPU, memory, and bandwidth for no reason. - Compliance Failures CIS Benchmarks, PCI-DSS, and HIPAA all require minimizing unnecessary services.
🔍 Step 1: Identify What’s Running
Check active services:
systemctl list-unit-files --type=service --state=enabled
Check open ports:
ss -tulnp
➡️ Any service listening externally that you don’t need is a candidate for shutdown.
Top comments (1)
Hi there, we encourage authors to share their entire posts here on DEV, rather than mostly pointing to an external link.
Sharing your full posts helps ensure that readers don’t have to jump around to too many different pages, and it helps focus the conversation right here in the comments section on DEV.
To be clear, the DEV Terms state:
Also, if you share your full post, you have the option to add a canonical URL directly to your post. This helps with SEO if you are reposting articles!