Setting up AFP on Ubuntu

I’m using VirtualMachines for many development tasks, as I don’t want to mess my host system. To Access the files on my machines I’m using AFP which is pretty easy to use.

This setup is based upon the work of The missing readme So this post is basically just a short reminder and howot for myself :) More informations in german.

First of alle we need to install the required services:

1
sudo apt-get install netatalk avahi-daemon libnss-mdns

Then we disable legacy protocols for our file server (this step is optional): Uncomment the following lines in “/etc/default/netatalk”

1
2
3
4
5
6
ATALKD_RUN=no
PAPD_RUN=no
CNID_METAD_RUN=yes
AFPD_RUN=yes
TIMELORD_RUN=no
A2BOOT_RUN=no

Add the Shares to “/etc/netatalk/AppleVolumes.default”

1
~/ "Home Directory" allow: cnidscheme:cdb options:usedots,upriv

Add mdns to host in /etc/nsswitch.conf

1
hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4 <strong>mdns</strong>

Add a new services File “/etc/avahi/services/afpd.service”

1
2
3
4
5
6
7
8
9
10
11
12
13
14
<?xml version="1.0" standalone='no'?><!--*-nxml-*-->
<!DOCTYPE service-group SYSTEM "avahi-service.dtd">
<service-group>
<name replace-wildcards="yes">%h</name>
<service>
<type>_afpovertcp._tcp</type>
<port>548</port>
</service>
<service>
<type>_device-info._tcp</type>
<port>0</port>
<txt-record>model=MacPro</txt-record>
</service>
</service-group>

If you want to change the Icon, just chaange the value of model to one of the following:

  • Xserve
  • PowerBook
  • PowerMac
  • Macmini
  • iMac
  • MacBook
  • MacBookPro
  • MacBookAir
  • MacPro
  • AppleTV1,1
  • AirPort

So then just restart the service or reboot your machine to get everything up.