How to make Samba file servers visible to Macs with Bonjour

15 May 2018

If you’re running Samba file services on a Linux server (specifically Ubuntu) and you’d like to be able to see that service from your Mac, simply install the avahi-daemon package on the Linux server, and place this little XML snippet into a file at /etc/avahi/services/samba.service (again, on the Linux box):

<?xml version="1.0" standalone='no'?><!--*-nxml-*-->
<!DOCTYPE service-group SYSTEM "avahi-service.dtd">

<service-group>
  <name replace-wildcards="yes">%h</name>
  <service>
    <type>_smb._tcp</type>
    <port>445</port>

  </service>
</service-group>

Restart the avahi-daemon service, typically with something like:

systemctl restart avahi-daemon # this must be run as root

After this, if you have your Finder preferences set to show “Bonjour computers” in the sidebar, you should see an icon with the Linux server’s name show up within a minute or two. Of course, this is just the service for announcing Samba’s presence; configuring Samba to actually provide file service is a whole other thing. I suggest reading the tutorial available from Ubuntu for a quick guide to the process if you only need a basic setup. Otherwise, take a look at the complete Samba docs or maybe hire a consultant who is up on their security best practices, especially if you have plans to put your Samba server anywhere near the public internet.