With Apple discontinuing support for AFP (Apple File Protocol) sharing here’s how to setup a server for use with legacy and modern Macintosh computers. As of macOS 12 Monterey AFP shares can still be accessed, but the following system can cater for much older Macintosh systems and I have personally used this to serve a Mac OS 8.6 client!
The server software is a combination of Netatalk (AppleTalk Server) and Avahi (an open source Bonjour style service based on Apple’s open source specifications). I have tried this setup with a number of Linux server systems running Debian GNU/Linux and Extra Packages for Enterprise Linux on Red Hat Enterprise Linux and all with issues. I noticed that the share icon on Mac OS looks like Beastie (The BSD Daemon mascot of FreeBSD) so I decided to try the setup with FreeBSD and it worked flawlessly.
You can run all this on a physical machine, or a virtual machine with bridge networking to your local network.
Let’s Start
- Download FreeBSD from https://www.freebsd.org and perform a minimal installation on your server machine; you only need a very basic system which we will add to shortly.
- With the system installed and running it is time to login as the ‘root’ user to install some packages and modify some configuration files.
- Update the system with
# freebsd-update fetch install
#and if given information to confirm with a ‘:’ prompt pressq
until they are all clear and the updates are applied. Use this step routinely to keep your base system up-to-date with security and bug fixes. - I recommend that we install Avahi now from prebuilt packages to reduce unnecessary build time as we don’t need the latest version. This is done with
# pkg install avahi
avahi-libdns # and entery
for any prompts. - We now need access to the ports system which provides build scripts for installing up-to-date software automatically from source code. Do
# portsnap fetch
# to download the build system then once that’s done# portsnap extract
# cd /usr/ports/net/netatalk3
- Install Netatalk with
# make install clean
# then accept defaults in the following prompts or customise if you know what you are doing. - Whilst we’re working with ports I suggest setting up a port manager to help with updating the system. I am familiar with portmaster although FreeBSD gives you choice. To install postmaster do:
# cd /usr/ports/ports-mgmt/portmaster; make install clean
# and accept defaults on any prompts if unsure.
Enabling AppleTalk (Netatalk) and Bonjour (Avahi)
We need to edit some configuration files which is done with ‘ee’ (Easy Editor) or a text editing system of choice. ee is straightforward to use and pressing ‘esc’ brings up a self explanatory menu for saving, discarding and exiting the editor. Do the following:
- ee /etc/nsswitch.conf
- Look for a line which reads:
hosts: files dns
- …and change it to read:
hosts: files mdns dns
- Save your edit with: ‘esc’ then ‘a’ (Leave Editor) and another ‘a’ (For save changes).
- To enable services at boot let’s do:
- ee /etc/rc.conf
- …and at the bottom of the file add:
- dbus_enable=”YES”
- avahi_daemon_enable=”YES”
- netatalk_enable=”YES”
- Save your edit with: ‘esc’ then ‘a’ (Leave Editor) and another ‘a’ (For save changes).
You should now have a working AppleTalk server after rebooting your FreeBSD System. You now need to create share points and reference them in /usr/local/etc/apf.conf
.
There is lots of cool stuff you can do within the configuration including set a Mac icon for the server which will display on Mac OS X and later clients in the finder, and you can present to have an Xserve is you want. You can enable various options for compatibility depending on your needs for example setting a character set for compatibility and clear text password authentication for old Mac OS versions (not secure so only do this in a physically secure network), and enable guest access so that anyone can access files you want to share.
Setting permissions for file access and modification is done in the FreeBSD system using the chmod, chown and group management commands. If you want to enable home folders for user the be aware that the ports system segregates itself from the FreeBSD system so you can only share home folders stored in ‘/usr/home’ and not ‘/home’. Another very important point is that most Unix filesystems are not compatible with Mac OS resource forks which are required for file decipherment and execution on the Macintosh which means that if you copy a file to one of your afp shares in the Unix environment you will probably render it inaccessible or damaged. The solution is only to manage files in your shares from a Macintosh computer as this triggers Netatalk to write the resource fork into a database completely without user interaction, and when accessing these files in the future they just look and behave exactly like regular Macintosh files. It is safe to modify permissions on the copied files so for example you can make a file or folder readonly to guests using the chmod command inside FreeBSD.
Following is an example of an afp.conf file enabling a Finder icon, guest access and clear text login from Mac OS 8.6 for a number of shares: afp.conf.zip
Conclusion
I hope this article was helpful to any Macintosh enthusiasts who come across my site. You can find information about looking after your FreeBSD system here, and you can enter ‘man afp.conf
‘ in your FreeBSD system to learn more about Netatalk.
Happy Mac’ing!