TIL there are Apple-specific Samba server configuration settings

• ~600 words • 3 minute read

I've been having fun with Raspberry Pis lately.

Besides my solar-powered website project, I've been playing with making tiny servers and hiding them around my apartment. To what end, I'm uncertain.

Already I can see myself falling into some kind of digital "Ideal Palace" obsession like Ferdinand Cheval—little computers in my garden, my books, and other hidden nooks-and-crannies, connected to my network with playful names and curious peripherals, tasked with curious purpose...

But this isn't about that. I'm simply writing to document an interesting thing I learned on the way to setting up a Samba server on one of those little computers.

So, what is a Samba server?

A Samba server is standard server software that lets you share files and printers on a network regardless of operating system. Historically it's (probably) the reason you can print your documents at work or the library when you're connected to the network or share files between machines.

Samba uses the SMB (Server Message Block) and CIFS (Common Internet File System) protocols to facilitate this.

If you have a macOS or Windows machine, these things typically “just work”—you’ll see other people’s machines and shared peripherals on the network, to the extent that they’ve been made public and set to share.

A screenshot of what I see in my network tab, where I have started to name my little computers are the moons of jupiter starting with Europa, Callisto and Ganymede

Why the Jovian naming convention you might ask? Besides the obvious reason being space is cool, there are 95 of them. That gives me ample room to lean into this theme.

Now, when I click into into any of those moons of Jupiter, I can peruse the folders I've specified as browseable in the Samba config on that machine.

A screenshot of browing the files on Ganymede

As you can see in that screenshot, I've set the home folder to be browseable. This is all on my private network at home, so there isn't really any risk. Maybe I'll reconsider all this some day.

There isn't really anything on there and I haven't decided what to do with it, but being able to remotely view and control the machine over VNC and see an item magically show up on the desktop that I dragged into the "Desktop" folder from my Mac is kind of fun.

Making it nice on macOS

Every time I'd tried to implement a Samba server from scratch on my Raspberry Pi it just felt... funky. I'm not articulating it well, but the experience I expected was more or less clicking on the name of the server and being able to browse the files, more or less like it's another folder. The stock Samba configurations never quite did this.

I noticed however that the out-of-the-box file sharing configuration for my Zimaboard did work the way I expected. What was different, I wondered?

Screenshot of the default Samba server configuration on my Zimaboard

Aha! Immediately the fruit: prefixed options jumped out at me.

It turns out there are some Apple-specific options you can set in your Samba config file. They're all prefixed with fruit:<option> and documented below:

With these fruit: prefixed values I can leverage Apple’s extended file attributes and metadata handling in macOS.

  • vfs objects = fruit streams_xattr enables better management of resource forks and Apple-specific file metadata, such as Finder information, which is stored using extended attributes. (I’m not sure why it’s commented out in the Zima configuration. I uncommented it for my Raspberry Pis because it seemed sensible after reading the definition.)
  • By setting fruit:metadata = stream and fruit:model = Macmini the server better mimics macOS file storage behavior and the icon that appears next to the machine in Finder. Kind of fun!
  • Disabling AppleDouble files (fruit:veto_appledouble = yes) helps avoid clutter, while enabling fruit:posix_rename and fruit:delete_empty_adfiles improves file renaming and cleanup.

A deeper-dive into howAPFS (Apple File System) works and interacts with SMB is next on my list for some future Sunday, but I thought I'd write something to further document that these vendor-specific options even exist, since they took me by surprise.

Hope it helps somebody!