Share Directories using AFP

From Gentoo Linux Wiki
Jump to: navigation, search

Contents

[edit] Introduction

[edit] Purpose

This tutorial will describe how to get a AFP share up and running on a Gentoo box, so a Mac client can mount the share.

[edit] Scope

This only covers how to use AFP over TCP, so AFP over AppleTalk is not covered.

[edit] References

[edit] Linux Server set-up

# emerge -pv net-fs/netatalk
# cd /etc/netatalk
# nano netatalk.conf
# nano afpd.conf
# nano AppleVolumes.default
# Remove unused services conf files from /etc/avahi/services
# nano /etc/avahi/services/afpd.service
# /etc/init.d/atalk start
# /etc/init.d/avahi-daemon restart
# rc-update add atalk default
# rc-update add avahi-daemon default

[edit] afpd.conf

This is the configuration of the AFP daemon. The default config works fine.


[edit] AppleVolumes.default

This file describes the network volumes shown on the Mac.

File: /etc/netatalk/AppleVolumes.default
/disk1/movies   MOVIES    allow:htpc,mobby options:ro
/disk1/itunes   AUDIO     allow:mobby
/disk1/pictures PICTURES  allow:mobby options:ro

'htpc' and 'mobby' are users names both existing on the local server and on the apple client.

[edit] Advertising the fileshare via Avahi

Avahi is software that implements the Zeroconf networking standard, so your file shares will show up automatically in the Mac client's Finder.

File: /etc/avahi/services/afpd.service
<?xml version="1.0" standalone='no'?><!--*-nxml-*-->
<!DOCTYPE service-group SYSTEM "avahi-service.dtd"> 
<service-group>
<!-- Customize this to get a different name for your server in the Finder. -->
<name replace-wildcards="yes">%h Gentoo AFP Server</name>
<service>
<type>_device-info._tcp</type>
<port>0</port>
<!-- Customize this to get a different icon in the Finder. -->
<txt-record>model=RackMac</txt-record>
</service>
<service>
<type>_afpovertcp._tcp</type>
<port>548</port>
</service>
</service-group>

[edit] Troubleshooting

For Avahi to work properly, make sure CONFIG_IP_MULTICAST=y is enabled in the kernel configuration. It is located under Networking Support/Networking Options/TCP IP Networking.

You need Avahi before you use netatalk. Make sure you have the "avahi" and "dbus" USE flags set, and emerge Avahi if you don't already have it.

Your network device must be in "promiscuous mode" for Zeroconf to work (No it doesn't multicast works without promiscuous). Issue the following command and edit these lines in the sysctl config file.

ifconfig eth0 promisc
File: /etc/sysctl.conf
# Enables source route verification
net.ipv4.conf.default.rp_filter = 0
# Enable reverse path
net.ipv4.conf.all.rp_filter = 0

[edit] Mac Client work

[edit] Mount the shared volume

Click on Finder, select Go / Connect to Server from the menu. Enter afp://<server hostname>/<name of share>. You should be ready to go.

Personal tools