Let Mac OS auto-discover your SMB shares

Mac OS can mount and read SMB shares. But with Samba only, you have to tell the Mac where there are. With avahi-daemon, SMB shares will be automatically discovered.

Install the Avahi service discovery suite. Chances are it was already installed by dependancies magic. If not, package is easy to find.

Once installed, find the location for configuration files and locate the “services” directory. On FreeBSD 11, go to /usr/local/etc/avahi/services. From there, create the following file:

# cat smb.service
<?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>
 <type>_device-info._tcp</type>
 <port>0</port>
 <txt-record>model=Xserve</txt-record>
 </service>
</service-group>

Configure the automatic start and launch avahi-daemon.

On the Mac, go to Network and… tada, here are the SMB shares. You already did install & configure Samba, didn’t you?

Bonus: you can set various value for txt-record. This will lead to a specific icon in the Finder.
Some options are :

  • Xserve
  • PowerBook
  • PowerMac
  • Macmini
  • iMac
  • MacBook
  • MacBookPro
  • MacBookAir
  • MacPro
  • AppleTV1,1
  • AirPort

Et voilĂ . So that’s what the daemon does… Among others things.

No Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

*

%d bloggers like this: