« Back to Systemd: Frequently Asked Questions

What is the difference between systemctl disable and systemctl mask?

What is the difference between systemctl disable and systemctl mask?

Using systemctl disable will no longer automatically start a service, while systemctl mask will administratively disable a service from running at all.

Systemd and its services can be in several states, such as enabled, disabled, failed, running. If you no longer need a particular service to run, then the first step is to stop a service.

systemctl stop nginx.service

But stopping a service is not the same as disabling a service. With that comes a very frequently asked question: what is the difference between a service that is disabled and one that is masked?

Difference disable and mask

When using disable to disabling a service, the underlying symlinks are removed. These symlinks normally activate the service during the boot process. Disabling a service sounds like it is not allowed to run, but it still may be activated if it is a dependency of another service.

Using mask will actually create a symlink pointing to /dev/null . This will making it no longer possible to start the service, until the moment that the unmask subcommand is used.

So the differences between disable and mask is that the latter is the most forceful way of disabling a unit.

Learn more about systemctl

This article uses the systemctl command to achieve its tasks. For this popular tool there is a cheat sheet available!

» Mastering the tool: systemctl

systemctl cheat sheet

Other questions related to Systemd

    Related articles

    Like to learn more? Here is a list of articles within the same category or having similar tags.

    Feedback

    Small picture of Michael Boelen

    This article has been written by our Linux security expert Michael Boelen. With focus on creating high-quality articles and relevant examples, he wants to improve the field of Linux security. No more web full of copy-pasted blog posts.

    Discovered outdated information or have a question? Share your thoughts. Thanks for your contribution!

    Mastodon icon