Your Ad Here

Configure a Netatalk File Server in Linux Based on Apple Filing Protocol (AFP) [Ubuntu Guide]

Netatalk

Apple computers communicate with one another using the Apple Filing Protocol (AFP). Using the freely-available implementation of this protocol called Netatalk, Ubuntu (currently Hardy Heron 8.04) can interface with Mac OS X (currently Leopard 10.5.2) and you can set up a AppleShare file server on a Ubuntu machine that is accessible to Macs on your local area network (LAN). The following guide will get you started.

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 aptitude 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 aptitude update
sudo aptitude 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 10.5 (Leopard), 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 com.apple.AppleShareClient afp_cleartext_allow -bool true



Installation Option Two - Encrypted Passwords

In order to install Netatalk so that it works natively with OS X Leopard-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 aptitude update
sudo aptitude install devscripts dpkg-dev

Next, install some password checker and SSL libraries.

sudo aptitude 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.0.3
sudo su
apt-get build-dep netatalk
DEB_BUILD_OPTIONS=ssl debuild -i -us -uc -b
debi
exit

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.



This post is one of five in a series on how to integrate Ubuntu into a Mac OS X Network. Check out the others linked to below.
Ubuntu Guide: Configure a Netatalk File Server Based on Apple Filing Protocol (AFP)
Ubuntu Guide: Configure Avahi to Broadcast Services via Bonjour to Mac OS X
Ubuntu Guide: Configure Vinagre to Share the Screen with Mac OS X
Ubuntu Guide: Configure a Firefly (mt-daapd) Streaming Media Server for iTunes and Front Row
Ubuntu Guide: Configure Netatalk to Share a USB Printerr




Have something to add? Send me a message on twitter or leave a comment below.

Viewing 16 Comments

 

Trackbacks

(Trackback URL)

close Reblog this comment
blog comments powered by Disqus

© Copyright Zaphu 2007. All rights reserved. -- Valid XHTML

Sitemap XML Sitemap XHTML