Apple Filing Protocol (AFP)

Intro

AFP is a standard Apple Mac OS X file sharing protocol. If you run local network with many Macs, it’s better choice than SMB or NFS. Netatalk is what we need to run AFP, but default debian package is built without ssl support due to some stupid openssl license incompartability. You can allow encryptionless connection on Macs, but it’s a bad idea. The best away is to rebuild netatalk package. If you’re not familiar with debian package build system, I’ll tell you how to rebuild netatalk fast. I’ve used Debian 5.0 (“Lenny”).

Building and installing

First, make sure there’re deb-src records in /etc/apt/sources.list. We should prepare for system for package build:

sudo aptitude update
sudo aptitude install automake libcrack2-dev
sudo apt-get build-dep netatalk
apt-get source netatalk

cd to a newly created directory (e.g. netatalk-2.0.3).

sudo DEB_BUILD_OPTIONS=ssl dpkg-buildpackage -rfakeroot
cd ..
sudo dpkg -i netatalk*.deb

Configuring

Now edit /etc/netatalk/afpd.conf. The only one uncommented line should be:

- -transall -uamlist uams_randnum.so,uams_dhx.so -nosavepassword -advertise_ssh -ipaddr 192.168.1.1

Don’t forget to change 192.168.1.1 with your server’s IP.

/etc/netatalk/AppleVolumes.default example:

# User-specific stuff

~/              "$u"            allow:nap,yukka

# Media

/home/ftp       ftp
/home/www       www             allow:nap,yukka
/home/shared    shared          allow:nap,yukka

Restart netatalk:

/etc/init.d/netatalk restart

Voila! Now you should be able to press Command-K whithin Finder and connect to afp://server.

If you want server to be visible as a shared network resource in Finder toolbar, you should configure avahi. It’s Bonjour (also known as ZeroConf) discovery service.

%d bloggers like this: