All my home machines are Macs now, except for the file server in my basement, which is a Debian box.
Previously, I had Samba installed on it so I could store some files from my other machines remotely. But using Windows file sharing between Macs and Linux just seemed wrong.
Here’s a very quick guide on how to get Apple file-sharing going on your Debian box, and how to make that server show up automatically in your Mac’s Finder. These instructions are specific to Debian (i.e. packages, paths, etc.), but should be easily modified to work on other flavours of Linux.
This guide was written mostly from memory, and with a get-it-up-now-and-edit-it-later mentality. If you notice anything wrong with the instructions, or something isn’t working, let me know and I’ll edit the guide where appropriate.
On your Debian box, you will need to install some packages. First, however you will need to add the following line to your /etc/apt/sources.list file:
deb http://interreality.org/software/debian unstable main
More on that later.
Now, run apt-get update and then install the following packages (and their dependencies):
Netatalk is “a freely-available, kernel level implementation of the AppleTalk Protocol Suite, originally for BSD-derived systems.” It will provide the file-sharing functionality (like Samba did).
Howl is “a cross-platform implementation of Zeroconf networking.” It will allow your Mac to automatically discover the Netatalk file server. Howl isn’t part of the main Debian package system, which is why you needed to add that extra line to the sources file.
If asked, just accept the default configuration options for now.
First, we need to enable AFP-over-TCP, which is how Apple file sharing works in OS X. Netatalk comes with some other daemons which we don’t really need: ATALKD to handle Appletalk (required for OS 9 and earlier, I think), TIMELORD, to serve time, a la ntpdate, and PAPD: an Appletalk printer daemon. Like I said, my Mac experience started with Jaguar, so I don’t really any of those. To disable them, you need to edit /etc/default/netatalk. Make sure the following options are set:
ATALKD_RUN=no PAPD_RUN=no AFPD_RUN=yes TIMELORD_RUN=no
We’re basically turning everything off except the AFP daemon.
Second, we need to specify the location of our shared directories. These are defined in /etc/netatalk/AppleVolumes.default. There are lots of configuration options in there. The default set up has this configuration line:
~/ "Home Directory"
This will share the home directory of whatever user logs in.
Note: because of the way Netatalk handles filename conversion between Mac and Linux, on my system I set up a separate directory for shared files, and another for the database and other control files Netatalk uses. The end result is my home directory isn’t as cluttered. My AppleVolumes.default looks like this (all one line):
var/local/shares/cmv/ "AFP Share" allow:cmv <font class="lf">¬</font> dbpath:/var/local/shares-db/cmv options:noadouble,nohex
Looking at the manpage for AppleVolumes.default describes all those options.
Finally, do a /etc/init.d/netatalk restart to get it all running.
At this point, you should have a working AFP file server. You can test by trying Finder › Go › Connect to server… and entering afp://servername/ as the server address.
If that doesn’t work, then something is wrong with your Netatalk configuration (check the logs), or maybe your internal network isn’t allowing the traffic. Make sure TCP ports 548 and 427, and UDP ports 548 and 5353 are open between your file server and the Mac (UDP 5353 is actually for Rendezvous/Zeroconf, which we’ll configure next).
Now, all that’s left is to set up Rendezvous (a.k.a. Zeroconf) on the file server, so your AFP share is automatically displayed in the Finder.
Create the file /etc/howl/mDNSResponder.conf (if it doesn’t exist) with the following line:
MyServer _afpovertcp._tcp local. 548
Feel free to change “MyServer” to something more descriptive; that is the text that will appear in the Finder.
What this is saying is that Howl should publish via Rendezvous the service called “MyServer”, which uses the “afpovertcp” service over TCP, on the local netblock, and that this service runs on port 548. If you have sshd running on the same machine, you can add this line too:
MyServer _ssh._tcp local. 22
Do a /etc/init.d/mdnsresponder restart to get it all running.
To test it, try running mDNSBrowse _afpovertcp._tcp from the command line on the file server. You should see something like:
browse reply: Add Service MyServer _afpovertcp._tcp. local. resolve reply: MyServer _afpovertcp._tcp. local. 192.168.0.1 548
On your Mac, go to Finder › Go › Network and click on the Local folder. Voilà, you should see an icon for your Debian file server. If you added the ssh configuration line above, you can also launch Terminal.app and try File › Connect to server…, then select the Secure Shell (ssh) service. Your Debian machine should show up in the list of servers.
Copyright © 2000-2012 Colin Viebrock • All Rights Reserved
14 June 2004, 09:16 • PermaLink
Under FreeBSD you have to also recompile the kernel.
Don’t remember there being a app like howl when I did the implementation but howl sounds cool for the next time I implement a similar setup.
19 June 2004, 09:03 • PermaLink
9 July 2004, 03:15 • PermaLink
21 July 2004, 02:14 • PermaLink
26 July 2004, 15:03 • PermaLink
Interreality provides the Debian packages for Howl here.
If you want the full source (to compile on another platform, for instance), you should grab it directly from Porch Dog Software here.
27 July 2004, 16:02 • PermaLink
as a File Server( running Suse 9.1) for my Macs.
I was gonna try to use NFS or Samba but after reading your blog, I’m gonna use netatalk.
Internet is filled with Windows and Linux networking how-to, but very little on Linux and OS X.
28 September 2004, 02:31 • PermaLink
11 January 2005, 21:27 • PermaLink
23 January 2005, 18:11 • PermaLink
13 February 2005, 02:14 • PermaLink
The newer howl packages in the main Debian repository are called mdnsresponder, and howl-utils instead of howl-tools.
Reed
30 March 2005, 15:22 • PermaLink
l-(root)
2.6.11-gentoo-r9)-(20 June 2005 – 22:46)-(pts/0)
mq-(/etc/conf.d)-> mDNSBrowse _afpovertcp._tcp
[assert] error: 111 (Connection refused)
[assert] where: “socket.c”, “sw_socket_tcp_connect”, line: 720
20 June 2005, 11:38 • PermaLink
realized that /etc/init.d/mDNSResponder wasn’t really starting the server. Manually starting /usr/bin/mDNSResponder fixes it.
1 October 2005, 15:07 • PermaLink
i believe the newest version of Netatalk (2.0.3) allows for long filenames
9 December 2005, 16:00 • PermaLink
Yes, Netatalk 2 fully implements AFP 3.1 which includes long file names and large files support.
7 January 2006, 21:28 • PermaLink
Thank a heap for this. I tried this last summer, and I was having issues with Fedora Core. However, I’ve got it up and running in an hour in Debian. It’s great – I’m using it to help speed up maintence on my mail, DNS, VPN and file servers.
Thanks again!
23 January 2006, 15:37 • PermaLink
This is pretty cool. How does AFP handle the resource fork issue when you copy or rsync a file over to the linux server. Thanks!
23 January 2006, 22:15 • PermaLink
Fantastic post, many thanks from buy auto parts
27 January 2011, 15:09 • PermaLink