Sunday, July 24, 2011

Linux to Mac Using AFP

I needed to move many files from my Fedora 14 Linux machine to my iMac. Samba, also known as SMB or Windows File Sharing, was being difficult trying to connect from Fedora to my iMac. The solution it seemed was to use AFP (Apple Filing Protocol). By default Fedora does not appear to have this enabled. So off to Google to find the answers.

First, I found that Linux supports AFP. On Fedora 14, it involves three utilities/services, netatalk, avahi, and afpd. To install these services, perform the following commands. I expect you have sudo or su access and know how yum works.

sudo yum install avahi netatalk

Once yum installs those packages you must configure the services.

Add the following to the end of your /etc/netatalk/afpd.conf file:
- -tcp -noddp -uamlist uams_randnum.so,uams_dhx.so,uams_dhx2.so -nosavepassword -advertise_ssh

Next, edit /etc/netatalk/netatalk.conf to ensure proper configuration. The following values need to be set:
ATALKD_RUN=no
PAPD_RUN=no
TIMELORD_RUN=no
A2BOOT_RUN=no
CNID_METAD_RUN=yes
AFPD_RUN=yes


To configure sharing of folders edit the AppleVolumes.default file. For example to configure the sharing of a folder named "Pictures" in the user Tom's home directory (/home/tom/Pictures) add the following line to AppleVolumes.default:
/home/tom/Pictures allow:tom rwlist:tom options:usedots,upriv

The AppleVolumes.default, as well as the other files mentioned, is well documented regarding options and settings.

Apple's Bonjour service is called mDNS on Fedora. To configure mDNS by defining a service for Avahi by creating the file /etc/avahi/services/afpd.service:
<?xml version="1.0" standalone='no'?>
<!DOCTYPE service-group SYSTEM "avahi-service.dtd">
<service-group>
<name replace-wildcards="yes">%h Xserve</name>
<service>
<type>_afpovertcp._tcp</type>
<port>548</port>
</service>
<service>
<type>_device-info._tcp</type>
<port>0</port>
<txt-record>model=Xserve</txt-record>
</service>
</service-group>


Then add mDNS to the hosts: line:
hosts: files mdns mdns4_minimal [NOTFOUND=return] dns
Configure the services for system startup with the following:
#chkconfig netatalk on
#chkconfig avahi-daemon on

Start the services:
#service netatalk start
#service avahi-daemon start

If either was already running change "start" above to "restart".

Open firewall ports 548 tcp to allow connections. Run "nbplkup" to ensure the Netatalk service is running. For me it displayed nothing although others have gotten the following:
"localhost:AFPServer" 65280.31:128
"localhost:netatalk" 65280.31:4
"localhost:Workstation" 65280.31:4




References

No comments:

Contributors