Apple Filing Protocol (AFP) File Server on Ubuntu Using Netatalk

Apple computers communicate with one another using the Apple Filing Protocol (AFP). Using the freely-available implementation of this protocol called Netatalk, Ubuntu can interface with Mac OS X and you can set up a AppleShare file server on a Ubuntu machine that is accessible to Macs on your local area network (LAN). To install Netatalk you have two options. Both are outlined below, but I recommend the second method for security reasons.

Installation Option One – Clear Text Passwords

Netatalk can be installed from the Ubuntu package repositories by simply using the apt-get package management program. To do so, execute the following commands in the terminal. (This may require that the Ubuntu install disk is in the CD drive.)

sudo apt-get update
sudo apt-get install netatalk

Unfortunately, this pre-compiled package only allows the use of clear text passwords (instead of encrypted passwords) due to legal reasons. This is fine for the purposes of file sharing on a LAN behind a firewall. However, there are a few things to keep in mind. First, clear text passwords may only be 8 or fewer characters in length and, thus, all users that intend to login in to and use the Netatalk AppleShare file server must have such a password. Second, if you are using OS X, clear text passwords are not permitted by default. However, it is easy to enable clear text passwords by executing the following command in a terminal on your Mac. (Note: Due to the page width, the command is wrapped below. But, it should be typed all on one line.)

defaults write afp_cleartext_allow 
-bool true

Installation Option Two – Encrypted Passwords

In order to install Netatalk so that it works natively with OS X-that is, allows encrypted passwords-the program must be recompiled using the appropriate SSL libraries. First we need to install some developer packages, which may require that the Ubuntu install disk be in the CD drive. At the command prompt type:

sudo apt-get update
sudo apt-get install devscripts dpkg-dev

Next, install some password checker and SSL libraries.

sudo apt-get install cracklib2-dev libssl-dev

Make a directory to hold the Netatalk source code, move to it, and download the code.

mkdir netatalk
cd netatalk
apt-get source netatalk

Now, move to the source code directory (the version number may change), switch to the root user, resolve and install the build dependencies for Netatalk, and build with the SSL option enabled (I’ve included several build options to suppress some error messages that arise because the build is not signed). The last commands below install the build and exit the root user.

cd netatalk-2.2
sudo su
apt-get build-dep netatalk
DEB_BUILD_OPTIONS=ssl debuild -i -us -uc -b

Finishing Up

If you used installation method two above (the custom build) then execute the following command to finish up. This command suppress updates of your custom Netatalk build. The program will break if Ubuntu tries to update it.

echo "netatalk hold" | sudo dpkg --set-selections

That’s it. Now you can connect to the Ubuntu AFP server by using Go > Connect to Server... in Finder on your Mac and entering your Ubuntu user name and password. By default your home directory on the Ubuntu machine will be served. To serve other directories you will have to modify the /etc/netatalk/AppleVolumes.default file. This file is well commented to guide you. One thing I wanted to do was to have a shared directory where anyone using my LAN could drop or retrieve files. The easiest way to do this (in order to get all the permissions correct) is to simply create a shared user on the Ubuntu machine in whose home directory shared content can be stored.

Congratulations, now your Ubuntu machine can serve files to Macs running OS X on the LAN. But it would be nice if your new Ubuntu Apple File Server broadcast its presence on the network and showed up in Finder on your Macs. This can be done using a program called Avahi which discovers and broadcasts services just like Bonjour. I show you how to install and configure Avahi in this post


  1. // Reply

    Thanks for posting this, great walkthrough. Its been very useful.

  2. // Reply

    Tell you what.. This has been very helpful connecting my Macs to my Apple TV / Crystalbuntu!


  3. // Reply


    I’m following the instructions for the “Installation Option Two – Encrypted Passwords” and I’m having an issue installing cracklib2-dev. I’m getting:

    E: Unable to locate package cracklib2-dev

    I’m using Ubuntu 12.10. Is this package no longer supported? Are there any workarounds? Thank you!

    1. // Reply

      Nevermind. The netatalk package included with 12.10 supports encrypted passwords – no workaround needed.

        1. // Reply

          the package is called libcrack2-dev 🙂
          took me a few minutes – thought i was going crazy!

    2. // Reply


      I am not aware of this package being unsupported. It still appears in the list of Debian packages on You can always download the package and manually install it instead of using apt-get. To be frank, I have done several setups as per this tutorial in the recent past but have stopped using encrypted passwords since all of the systems are on my LAN. I have found the extra hassle of using encrypted passwords to not be worth the benefits. Good luck.

  4. // Reply

    Hi. Trying to install this o ubuntu 14.04 server. When I try to install cracklib2-dev I get the following message:
    E: Unable to locate package cracklib2-dev

    Any tips?

    Many thanks – Mark

Leave a Reply

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