How to share folders on the Pi using Apple Filing Protocol (AFP)

Following this guide, you will be able to share any folder on your Raspberry Pi using AFP and easily connect to them from your Mac OS X device.

Apple Filing Protocol is Apple's proprietary network protocol for distributing files over the network. This is Apple's replacement for the Server Message Block (SMB) and Network File System (NFS) protocols.

Following this guide, you will be able to share any folder on your Raspberry Pi using AFP and easily connect to them from your Mac OS X device.

All of this is possible with the Netatalk software. The software implements the AFP protocol at the server level, allowing the Raspberry Pi to distribute files through it.

Setting up AFP on Raspberry Pi

Step 1. Now, before you can set up AFP on your Raspberry Pi, you must ensure that the operating system is up to date.

To make sure everything is up to date, run the two commands below.

sudo apt update sudo apt upgrade

Step 2. With the Raspberry Pi now up to date, you can now go ahead and install the package that will take care of everything. The package you are installing is called Netatalk. Open source Netatalk is used to implement the free Apple Filing Protocol (AFP).

Install the Netatalk application onto the Raspberry Pi by running the following command.

sudo apt install netatalk

Step 3. After installing Netatalk software, now you have to continue configuring it to share different folders.

First, let's look at how to add folders for sharing. To do this, you must modify the afp.conf file by running the command below.

sudo nano /etc/netatalk/afp.conf

Step 4. In this file, add the following text at the end.

Add home folders

[Homes] basedir regex = / home

This block identifies the home directories. This block will allow any connected users to access their respective home directories.

Identify 'basedir regex' so that the Netatalk software knows where to find the user's home directory.

If you want to lock users to a specific directory in their main path, you can add the following option. Where is the name of that directory.

[Homes] basedir regex = / home path = 

Add custom folders

[My AFP Share Name] path = / path / to / directory

Using something like above, you can share any folder you want.

In square brackets ([]) specifying when to start sharing is the name given to the sharing.

The option 'path =' is the path to the folder you want to share over the AFP protocol.

Create a share as an Apple Time Machine

[My AFP Share Name] path = / path / to / directory time machine = true

You can specify any sharing as a shareable time machine, by simply adding the option 'time machine = true' below.

Share read-only

[My AFP Share Name] path = / path / to / directory read only = true

If you want the share to be read-only, all you have to do is add 'read only = true' to it. This option is useful for sharing, such as sharing media library.

Set up a guest account

[Global] guest account = pi

You can specify the guest account to use for connections by setting "guest account = 'in the' [Global] 'header. By default, this is set to' nobody '.

More information on available options can be found by visiting the Netatalk configuration documentation at.

http://netatalk.sourceforge.net/3.1/htmldocs/afp.conf.5.html

Step 5. Once changes to the configuration are complete, you can go ahead and save the file by pressing CTRL + X then pressing Y, and then pressing ENTER.

Step 6. Since you have made changes to the Netatalk configuration, it is necessary to restart the service so that it can use the new configuration.

Restart the service by running the following command.

sudo systemctl restart netatalk

7. Before connecting to the newly shared folders, you should retrieve the IP address assigned to the Raspberry Pi. Make sure you have an active network connection using either WiFi or an Ethernet cable. Write this IP down as you will need it to connect to the shared drive.

sudo hostname -I

Connect to Pi's AFP sharing process on Mac OS X

Step 1. To connect to the AFP sharing process on Raspberry Pi, start by opening the Finder app available on Mac OS X.

How to share folders on the Pi using Apple Filing Protocol (AFP) Picture 1How to share folders on the Pi using Apple Filing Protocol (AFP) Picture 1

Step 2. Now go ahead and click 'Go' on the toolbar at the top of the screen. Next, click on the option 'Connect to Server…'.

How to share folders on the Pi using Apple Filing Protocol (AFP) Picture 2How to share folders on the Pi using Apple Filing Protocol (AFP) Picture 2

Step 3. In this dialog box, you will need to enter the Raspberry Pi's IP address after 'afp: //'.

For example, with the Raspberry Pi's IP address being '192.168.0.159', you need to type 'afp: //192.168.0.159' into the input box. Once entered, click the 'Connect' button to continue.

How to share folders on the Pi using Apple Filing Protocol (AFP) Picture 3How to share folders on the Pi using Apple Filing Protocol (AFP) Picture 3

Step 4. When connecting to your Raspberry Pi, you will be greeted by a dialog box asking you to enter your username and password to connect to the Apple Filing Protocol server.

Since the article is only for the default user, the example uses "pi" as the name and "raspberry" as the password. After entering the user to connect, go ahead and click the 'Connect' button to continue.

How to share folders on the Pi using Apple Filing Protocol (AFP) Picture 4How to share folders on the Pi using Apple Filing Protocol (AFP) Picture 4

Step 5. After successfully logging into the Raspberry Pi's AFP share, you will now be asked which volumes you want to mount.

This dialog box displays all the folders that you set up earlier in the tutorial, each referenced by the name you put next to that share in the configuration file.

Select the volume you want to mount. Then click the OK button to continue.

How to share folders on the Pi using Apple Filing Protocol (AFP) Picture 5How to share folders on the Pi using Apple Filing Protocol (AFP) Picture 5

Step 6. Finally, you should be able to view your mounted shares to your Mac OS X device.

Below, the post has included a screenshot showing the networked drives in "Locations" in the sidebar. The example also shows shared volumes in the Finder app.

How to share folders on the Pi using Apple Filing Protocol (AFP) Picture 6How to share folders on the Pi using Apple Filing Protocol (AFP) Picture 6

At this point, Apple Filing Protocol is running on your Raspberry Pi. You can also use a MAC OS X device to successfully connect to your shared folders via the AFP protocol.

4 ★ | 36 Vote