Skip to content

Instantly share code, notes, and snippets.

@sphaugh
Created April 7, 2025 15:48
Show Gist options
  • Save sphaugh/f9ca32576b1c76e64f2f147b9d5da9fb to your computer and use it in GitHub Desktop.
Save sphaugh/f9ca32576b1c76e64f2f147b9d5da9fb to your computer and use it in GitHub Desktop.
disable.md

To completely disable a service in systemd (so it doesn't start automatically and can't be started by dependencies), follow these steps:


πŸ”§ 1. Disable the service

This stops it from starting automatically on boot:

sudo systemctl disable <service-name>

🚫 2. Mask the service

This makes it impossible to start the service manually or automatically (even by another service):

sudo systemctl mask <service-name>

This creates a symlink from the service file to /dev/null, effectively making it unusable.


πŸ” Optional: If you want to undo this later:

  • To unmask:
sudo systemctl unmask <service-name>
  • To enable again:
sudo systemctl enable <service-name>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment