• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

How to Mask or Unmask a Service in CentOS/RHEL 7 and 8

by admin

Question: How can we mask/unmask a service in CentOS/RHEL 7 and 8?

Masking a Service

To prevent conflict between similar types of services that perform a certain function, masking is used. For example, for a firewall, CentOS 7 has both iptables and firewalld services; however, it is recommended to use only one at a time. Hence, one of the two firewall services is masked to prevent conflict between the two services. Masks prevent the accidental startup of a service by creating a symlink of the service file to /dev/null as shown in the example below.

In this example the sendmail service is masked:

# systemctl restart sendmail
Failed to restart sendmail.service: Unit is masked
#

Also you can check the masked services using this command:

# systemctl list-unit-files | grep -i mask
mdmonitor.service masked
sendmail.service masked
smartd.service masked
uptrack-late.service masked
#

Masking a Service

The command “systemctl mask [service]” is used to mask the service avoid to start it:

# systemctl mask firewalld
Created symlink from /etc/systemd/system/firewalld.service to /dev/null.
#

UnMasking a Service

The command “systemctl unmask [service]” is used to unmask the service and be able to start it:

For example:

# systemctl unmask firewalld
Removed symlink /etc/systemd/system/firewalld.service.
#

Filed Under: CentOS/RHEL, CentOS/RHEL 7, CentOS/RHEL 8, Linux

Some more articles you might also be interested in …

  1. How to Migrate virtual machines from one host to another in the Red Hat Virtualization environment
  2. gsettings Command Examples in Linux
  3. CentOS / RHEL : How to delete LVM volume
  4. iptables: command not found
  5. CentOS / RHEL : Beginners guide to vsftpd (installation and configuration)
  6. CentOS/RHEL: “id” command doesn’t list the Group Name against GID for LDAP Users
  7. Common Init.ora Parameters and Unix, Linux Kernel Parameters and Relationship Between Them
  8. feedreader: command not found
  9. apt-cache: command not found
  10. How to delete unused kernels and keep only the running kernel in CentOS/RHEL

You May Also Like

Primary Sidebar

Recent Posts

  • protonvpn-cli Command Examples in Linux
  • protonvpn-cli connect Command Examples
  • procs Command Examples in Linux
  • prlimit: command not found

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright