Skip to main content
CentOSRH124

Preventing Services from Running with systemd on CentOS 7

centos7The use os systemd over upstart and the traditional SysV init scripts is a big step for Red Hat but it does bring benefits with it. In this tutorial we look at going beyond disabling of a service and using the new mask feature to prevent the service being accidentally started.


Service units are managed ini CentOS 7 using the systemctl program. We can use it with the command action and then service:

systemctl start firewalld

The actions that we have are the ones that you would expect:

  • start
  • stop
  • status
  • enable
  • disable

If a service is disabled it may still be started by an administrator it merely means that it will not be started automatically on boot.

But we now can prevent this with mask and unmask. If we mask a service:

systemctl mask firewalld

The it cannot be started at all until it is is unmasked

systemctl unmask firewalld