How to Disable Avahi-Daemon in Linux

Avahi-daemon is a service running on Linux systems that provides network service discovery using mDNS (Multicast DNS) and DNS-SD (DNS Service Discovery).

It helps devices and applications find each other on a local network without needing to configure the DNS server manually.

This service is particularly useful for home networks or small office environments where devices like printers, file shares, and media servers need to be discovered easily by other devices.

Why Enable Avahi-Daemon?

Enabling Avahi-daemon can be beneficial in many scenarios:

  • It simplifies the process of connecting to network services.
  • Ideal for homes with multiple devices like smart TVs, printers, and computers that need to communicate.
  • Facilitates the discovery of shared resources like files and printers.
  • It is useful for developers who must discover and test network services without dealing with complex configurations.

Why Disable Avahi-Daemon?

While Avahi-daemon is useful, there are reasons you might want to disable it:

  • Broadcasting services on the local network can pose a security risk, especially in larger or less trusted networks.
  • It consumes system resources, so disabling it can free up CPU and memory for other tasks.
  • Some networks, particularly in corporate environments, have strict policies against auto-discovery services.
  • If you do not use any service that requires Avahi, it makes sense to disable it to simplify your system.

How to Disable Avahi-Daemon on Systemd-based Systems

To disable avahi-daemon, you need to stop the avahi-daemon service and prevent it from starting automatically at boot as shown.

sudo systemctl stop avahi-daemon
sudo systemctl disable avahi-daemon

Next, you need to mask it so that it impossible to start the service manually or automatically by other services.

sudo systemctl mask avahi-daemon

Finally verify that avahi-daemon is no longer running.

sudo systemctl status avahi-daemon

How to Enable Avahi-Daemon in Linux

To enable avahi-daemon again, you need to umask, enable and start the service so that it starts automatically at boot.

sudo systemctl unmask avahi-daemon
sudo systemctl enable avahi-daemon
sudo systemctl start avahi-daemon

To ensure that avahi-daemon is running and enabled, check its status with the following command.

sudo systemctl status avahi-daemon

How to Disable Avahi-Daemon on Non-Systemd Systems

Disabling or enabling avahi-daemon in a non-systemd distribution involves different steps than systemd-based distributions. Non-systemd distributions often use init systems like SysVinit, Upstart, or OpenRC.

On SysVinit

To disable avahi-daemon on SysVinit systems, you need to stop the service and prevent it from starting automatically at boot as shown.

sudo /etc/init.d/avahi-daemon stop
sudo update-rc.d -f avahi-daemon remove

To enable the avahi-daemon service again, run the following commands.

sudo update-rc.d avahi-daemon defaults
sudo /etc/init.d/avahi-daemon start

On Upstart

To disable avahi-daemon on Upstart systems, you need to stop the service and disable it from starting at boot as shown.

sudo stop avahi-daemon
sudo sh -c 'echo "manual" > /etc/init/avahi-daemon.override'

To enable the avahi-daemon service again, you must remove the override and start the service.

sudo rm /etc/init/avahi-daemon.override
sudo start avahi-daemon

On OpenRC

To disable avahi-daemon on OpenRC systems, you need to stop the service and disable it from starting at boot as shown.

sudo rc-service avahi-daemon stop
sudo rc-update del avahi-daemon default

To enable the avahi-daemon service again, run the following commands.

sudo rc-update add avahi-daemon default
sudo rc-service avahi-daemon start
Conclusion

avahi-daemon is a useful service for discovering network services effortlessly, especially in home and small office networks. However, it may not be necessary or desirable in all environments, particularly where security and performance are prioritized.

Hey TecMint readers,

Exciting news! Every month, our top blog commenters will have the chance to win fantastic rewards, like free Linux eBooks such as RHCE, RHCSA, LFCS, Learn Linux, and Awk, each worth $20!

Learn more about the contest and stand a chance to win by sharing your thoughts below!

Ravi Saive
I am an experienced GNU/Linux expert and a full-stack software developer with over a decade in the field of Linux and Open Source technologies

Each tutorial at TecMint is created by a team of experienced Linux system administrators so that it meets our high-quality standards.

Join the TecMint Weekly Newsletter (More Than 156,129 Linux Enthusiasts Have Subscribed)
Was this article helpful? Please add a comment or buy me a coffee to show your appreciation.

3 Comments

Leave a Reply

Got Something to Say? Join the Discussion...

Thank you for taking the time to share your thoughts with us. We appreciate your decision to leave a comment and value your contribution to the discussion. It's important to note that we moderate all comments in accordance with our comment policy to ensure a respectful and constructive conversation.

Rest assured that your email address will remain private and will not be published or shared with anyone. We prioritize the privacy and security of our users.