Netatalk, Linux and the Macintosh

With Netatalk, you can drag and drop files from Linux to Mac and back, share system resources and more.
Configure Appletalk

First, add the contents of the services.atalk file that accompanies the Netatalk distribution to your /etc/services database. The lines to add will look like this:

rtmp    1/ddp   # Routing Table Main Protocol
nbp     2/ddp   # Name Binding Protocol
echo    4/ddp   # AppleTalk Echo Protocol
zip     6/ddp   # Zone Information Protocol

Next, assuming that your physical connection between Linux and the Mac is Ethernet, edit the /usr/local/atalk/etc/atalkd.conf file so that it contains the single line:

This line is automatically changed when the system is placed into service. In my case, when I actually connected to the network, the eth() line (the file configuration) was changed by the Appletalk daemon to:
eth0 -phase 2 -net 7540-7544 -addr 7544.197 \
        -zone "Outer-Limits"

Figure 3. Your eyes aren't deceiving you—It's a web site devoted entirely to Netatalk.

Exporting Linux

The Netatalk distribution provides three sample configuration files that need to be configured:

  1. AppleVolumes.default

  2. atalkd.conf

  3. papd.conf

These files are normally placed in the /usr/local/atalk/etc directory, and contain instructions in the form of comments to aid the user. You can get additional information from the man pages. We have already discussed the configuration of atalkd.conf during Appletalk configuration.

You specify which files and/or directories are made accessible to the Macintosh by editing the file /usr/local/atalk/etc/AppleVolumes.system. Here's a sample configuration is shown in Listing 1. This configuration shows that the directories /tmp and /pub are available to the network. On the Macintosh a Linux directory appears as a folder with a name you assign: in our example tmp and pub. The directory /home/user/X is also accessible from the Macintosh under the name XWindows. You specify that an exported directory will have a different name on the Mac, using a different second parameter than the Linux directory name, such as /home/user/X XWindows.

We advise caution when deciding which directories to export to the network. The Netatalk daemon afpd (Apple Filing Protocol Daemon) creates additional files for housekeeping. Specifically, in each of the exported directories, two invisible files (that is, files beginning with a period character) are created, namely, .AppleDesktop and .Appledouble. These files are created in all Linux directories and subdirectories that are exported and accessed. If you export an entire file tree using the / character, you will find your Linux system cluttered with .AppleDesktop and .Appledouble files.

Also, note that the file /usr/local/atalk/etc/AppleVolumes.system contains a list of file extensions. This list is not necessary, but the extensions provide a means for displaying the appropriate icons on the Macintosh desktop. For example, in Figure 1 you can see that the files z.mpg, z.rtf and zz.jpg are displayed with the correct Macintosh application icon.

Sharing the Linux Printer

You can make a printer connected to your Linux system available to the Appletalk network by using papd (the Appletalk Printer Access Protocol Daemon), which is started when booting Linux. The papd daemon accepts printing requests from the Macintosh and spools the job to the local line printer. To configure the printer, edit the file /etc/local/atalk/etc/papd.conf to look like this:

# Sample papd.conf file to allow
# printing on the Linux printer over
# the Appletalk network.

The syntax used in this file is the same as used in the Linux printcap file that you can find on most Linux systems in /etc/printcap.

Netatalk Startup

The file rc.atalk located in the directory specified by the variable ETCDIR (normally /usr/local/atalk/etc) must be executed at startup. To do this on a Linux system on which the rc files are to be kept in one place, copy /usr/local/atalk/etc/rc.atalk to the /etc/rc.d directory or make a symbolic link. Then, using a text editor, insert the following line in the rc.local file:

sh /etc/rc.d/rc.atalk

For more information about this script, consult the Netatalk man pages.


Geek Guide
The DevOps Toolbox

Tools and Technologies for Scale and Reliability
by Linux Journal Editor Bill Childers

Get your free copy today

Sponsored by IBM

8 Signs You're Beyond Cron

Scheduling Crontabs With an Enterprise Scheduler
On Demand
Moderated by Linux Journal Contributor Mike Diehl

Sign up and watch now

Sponsored by Skybot