xbsd.nl

Apple AFP filesharing on FreeBSD

28 Sep 2010

On a Mac and have some FreeBSD file-servers around the house of office? Open your file-servers up to easy and fast access via OS X Finder. How? The method is Apple's native Apple Filing Protocol (AFP), with a bit of help of Apple Bonjour (mDNSResponder) for automatic discovery and presentation of shared resources on the network. The installation and config of the two Ports 'netatalk' and 'howl' is all there is to it. In a nutshell: Install the Ports. 'netatalk' is the AFP Daemon:
[martijn@shinobu /usr/ports]$ cd /usr/ports/net/netatalk
[martijn@shinobu /usr/ports/net/netatalk]$ sudo make config
Select the protocol and authentication features you're planning on using:
[ ] APPLETALK Enable AppleTalk protocol support [ ] SRVLOC Enable Service Location Protocol support [X] PAM Enable PAM support [ ] TIMELORD Enable Timelord network time service [ ] KRB5 Enable Kerberos V UAM
Install and cleanup:
[martijn@shinobu /usr/ports/net/netatalk]$ sudo make install clean
Install the 'howl' port for Bonjour or mDNS support.
[martijn@shinobu /usr/ports]$ cd /usr/ports/net/howl
[martijn@shinobu /usr/ports/net/howl]$ sudo make install clean
Add the following to /etc/rc.conf:
netatalk_enable="YES"
afpd_enable="YES"
cnid_metad_enable="YES"
mdnsresponder_enable="YES"
mdnsresponder_flags="-f /usr/local/etc/mDNSResponder.conf"
Create and edit the configuration files.
Netatalk:
[martijn@shinobu /usr/local/etc]$ pwd/usr/local/etc
[martijn@shinobu /usr/local/etc]$ sudo cp AppleVolumes.default.dist AppleVolumes.default
[martijn@shinobu /usr/local/etc]$ sudo vim AppleVolumes.default
By default, only user home-directories are shared by netatalk. See the '~' at the end of the file 'AppleVolumes.default'. Additional, or more generic, shares can be created by adding the to the'AppleVolumes.default' file.
Howl:
Define the services to be announced by Bonjour. First field presents the servername, second the mDNS services, third and last the domain and port-number to be used.
[martijn@shinobu ~]$ sudo vim /usr/local/etc/mDNSResponder.conf

shinobu         _afpovertcp._tcp        local.  548
shinobu         _ssh._tcp               local.  22
As you see, the OpenSSH service can also be announced. Simply by adding the _ssh._tcp mDNS service.
Startup both 'netatalk' and 'mDNS':
[martijn@shinobu /usr/local/etc]$ sudo /usr/local/etc/rc.d/netatalk start
[martijn@shinobu /usr/local/etc]$ sudo /usr/local/etc/rc.d/mdnsresponder start
Next up, startup OS X Finder on your Mac and you'll see your new AFP Shares in the 'Share' item list.

blog comments powered by Disqus