Systemctl Mask vs Systemctl Disable

Linux TLDR
Last Updated:
Reading time: 2 minutes

The โ€œsystemctl maskโ€ and โ€œsystemctl disableโ€ are both crucial commands for Linux administrators, and you must know their differences to decide which one to choose in certain situations.

The โ€œsystemctl enableโ€ command allows your services to start on system boot. If you disable your service and other services or dependencies are using it, they are allowed to start your service on system boot.

However, if you mask your services using the โ€œsystemctl maskโ€ command, no matter what services or dependencies require your service, it will not start manually or on the system boot.

This is all done with the help of symbolic links, also known as symlinks.

For example:

The service is enabled because there is a symbolic link at the โ€œ/etc/systemd/systemโ€ path to the unit file located at the โ€œ/lib/systemd/systemโ€ path.

When you enable a service, the full path of the created symbolic link and target will be printed to stdout.

However, when you disable the service using the โ€œsystemctl disableโ€ command, it will remove the symbolic link, which surely is not going to affect your original unit file, but the service will not be able to load on the next boot when systemd reads the โ€œ/etc/systemd/systemโ€ path.

Although the other services or dependencies can start the disabled service on the system boot, you can manually start it by firing up the command on the terminal.

But in the โ€œsystemctl maskโ€ command, the service is a symlink to the โ€œ/dev/nullโ€ file. which makes it impossible to start on system boot or manually by you, even if it is required by another service or dependency.

To let it start on system boot or manually by you or dependencies, you need to unmask it using the โ€œsystemctl unmaskโ€ command, which will delete the symlink pointing to the โ€œ/dev/nullโ€ file.

It is also important to know that you cannot mask critical services, like system services.

I hope you understood their difference in this TL;DR version. If you have any questions or quaries, please leave them in the comments section.

Join The Conversation

Users are always welcome to leave comments about the articles, whether they are questions, comments, constructive criticism, old information, or notices of typos. Please keep in mind that all comments are moderated according to our comment policy.