Disable avahi (zeroconf) for ssh & sftp

  • Hi everyone, I couldn't find anything in the GUI nor in the section Wiki, Forum help sections.

    I'm currently using LE 11.0.3 on a RPI 4 - but for this, it should not make a difference.

    Anyhow, is there a way to disable the Zeroconf / avahi broadcast of only ssh & sftp. The reason being, I still want the service enabled but I don't want it announced on the network. Furthermore I changed the ssh/sftp port, so the default .service files don't apply anyway.

    To be clear, I only want to disable ssh/ sftp, but still use avahi to announce all the other beautiful services, i.e. AirTunes, pulse audio sink, json-rpc ... :)

    Any help is appreciated !

  • Thanks for your quick reply.

    "systemctl stop avahi && systemctl disable avahi"

    TO BE CLEAR: I still want to use avahi to announce services, but NOT ssh/ sftp.

    Ideally it would be something like, (if /etc were not on a read-only partition)

    Code
    rm /etc/avahi/services/ssh.service
    rm /etc/avahi/services/sftp-ssh.service
  • Hide the static avahi service files by over-mounting the directory:

    Code
    mount -t tmpfs tmpfs /etc/avahi/services

    You can create a systemd drop in file for the avahi unit and add a ExecStartPre=/usr/bin/mount ... line.

  • Hide the static avahi service files by over-mounting the directory:

    Code
    mount -t tmpfs tmpfs /etc/avahi/services

    You can create a systemd drop in file for the avahi unit and add a ExecStartPre=./usr/bin/mount .. line.

    Thanks. I thought there might be a simpler solution (I haven't already thought of).

    Unfortunately avahi does not provide any mechanism itself to change the directory.


    Please mark this on as solved.