Methods of payment Abuse

How to Disable Unnecessary Services in Linux and Free Up Resources

16.06.2025, 17:45

When you're setting up a server for your specific tasks, you want it to run fast and clean — without extra stuff getting in the way. But here's the catch: many modern Linux distributions, especially those using systemd, automatically start a bunch of services by default. Even the ones you don’t need. These background services can quietly eat up system resources — and sometimes even become security risks. Let’s go over how to find and disable services you don’t actually need on popular Linux distros like Fedora, CentOS, Ubuntu, and Debian.

Why Bother with This at All?

When you install Linux, the system often enables a whole range of services by default. Web servers, FTP, print services, various network tools — all of that might be running, even if you never asked for it. If your server doesn’t use them, they’re just wasting memory, CPU, and exposing extra surfaces for attack.

Before disabling anything, ask yourself a few quick questions:
— What exactly do I want this server to do?
— Should it host a website?
— Am I using FTP or Samba?
— Does it run a DNS or database server?

Only keep what you really need.

How to See What’s Running

Systemd makes it easy to manage and check active services. To see what’s currently running, use this:
sudo systemctl list-units --type=service --state=running

Take a careful look at the list. If something has nothing to do with your server’s purpose, it’s probably safe to disable.

How to Check Open Ports

To find out which services are listening for incoming network connections, run:

sudo ss -tuln

or

sudo netstat -tuln

This will show all open TCP and UDP ports. For instance, if port 21 (used by FTP) is open but you don’t use FTP — that’s a good sign you should shut that service down.

Common Services You Can Likely Disable

Here’s a list of services that are often running by default — but may not be useful in your case:
→ avahi-daemon – local device discovery (often not needed).
→ bluetooth.service – Bluetooth management (not needed on servers).
→ iscsi* – for iSCSI network storage.

→ lvm2-* – for managing LVM volumes.

→ mdmonitor, raid-check – RAID monitoring tools.

→ qemu-guest-agent – only useful inside QEMU/KVM virtual machines.

→ nfs-* – related to NFS (network file systems).

→ cups.service – printer support (rarely needed on a server).

→ postfix.service – mail server; useful only if you actually send email.

→ sssd.service – for LDAP or domain integration.

→ hyperv-daemons – only needed in Hyper-V virtual machines.

→ apport.service – Ubuntu’s error reporting tool.

→ zeitgeist, telepathy – desktop-related logging and messaging services.


How to Disable These Services

To disable any of the services listed above, just run:

sudo systemctl disable avahi-daemon
sudo systemctl disable bluetooth
sudo systemctl disable iscsi
sudo systemctl disable iscsid.socket
sudo systemctl disable iscsiuio.socket
sudo systemctl disable lvm2-monitor
sudo systemctl disable lvm2-lvmpolld.socket
sudo systemctl disable mdmonitor
sudo systemctl disable raid-check.timer
sudo systemctl disable qemu-guest-agent
sudo systemctl disable nfs-convert
sudo systemctl disable nfs-client.target
sudo systemctl disable cups
sudo systemctl disable postfix
sudo systemctl disable sssd
sudo systemctl disable hyperv-daemons
sudo systemctl disable apport
sudo systemctl disable zeitgeist
sudo systemctl disable telepathy

Want to stop them right away too? Just replace disable with stop to shut them down immediately:
sudo systemctl stop avahi-daemon

How to Check What Starts on Boot

Not sure what gets launched automatically when your system boots? Here are a few handy commands:
→ To list all services enabled at startup:

systemctl list-unit-files --type=service --state=enabled

→ To see all currently running services:

systemctl list-units --type=service

→ To analyze which services slow down boot time:

systemd-analyze blame

Pay attention to anything that takes several seconds. If you don’t need it — disable it.

How to Stop and Block a Service from Starting Again

If you come across something unnecessary:

sudo systemctl stop service_name
sudo systemctl disable service_name

Want to block it completely — even from being started manually or as a dependency?

sudo systemctl mask service_name

Changed your mind later?

sudo systemctl unmask service_name

Final Thoughts

Disabling unnecessary services helps you free up memory, improve performance, and shrink your server’s attack surface. With systemd, the process is quick and painless.

Remember: a server that runs only what it needs will always run faster and safer. Keep things lean and under control.