THE US POSTAL SERVICE IS EXPERIENCING SIGNIFICANT DELAYS. WE SUGGEST UPS SHIPPING IF YOU ARE IN A HURRY. CLICK HERE FOR DETAILS.

Using Netatalk to share files between a Raspberry Pi and Mac

December 12, 2019 2 Comments

Using Netatalk to share files between a Raspberry Pi and Mac

We love using Raspberry Pi's to do all sorts of things around the office, but it can be a bit of a pain accessing the files on the Pi from our Apple Macintosh computers.  

We have always used Netatalk to allow file sharing, but it seemed to break with the latest version of Raspbian Buster.

Fortunately, we figured how how to fix this problem today!  

First, you will want to install Netatalk on your Pi.  The following commands update Raspbian's package information and then downloads the latest version of Netatalk

sudo apt-get update
sudo apt-get install netatalk

 

It used to be that these two commands were enough to get Netatalk working.  You'd simply go into your Mac's finder, click "Network", see your Raspberry Pi, and hit Connect.  With Buster, this stopped working.  In our log files, we could see the Mac trying to connect, but then the Mac would throw an error.

Netatalk 3.x is generally controlled by a file called /etc/netatalk/afp.conf

If you are using a version Netatalk prior to 3.0, the below configuration file changes should not be necessary.  You can see which version you have by typing "apt-cache policy netatalk"

If you take a look at the default install of that file, you will see something like this:

; Netatalk 3.x configuration file
;
[Global]
; Global server settings
; [Homes]
; basedir regex = /home
; [My AFP Volume]
; path = /home/pi
; [My Time Machine Volume]
; path = /path/to/backup
; time machine = yes
; log file = /home/pi/afp.log
Those semi colons indicate almost every line in the above file are commented out.  So, by default, nothing in shared in Netatalk.  From a security standpoint this is nice, but from a usability standpoint it seems a bit overkill.
 
To allow Netatalk to connect to /home/pi, all you have to do is uncomment two lines:
[Homes]
basedir regex = /home
 
Note: on the basedir line, if you see the following:
basedir regex = /xxxx
change it to
basedir regex = /home
And then restart Netatalk with:
sudo systemctl restart netatalk
With any luck, when you go to Network in your Mac's Finder, you will see your Pi and you can connect to it.  Don't forget to change the username to pi (or whatever username you use on your Pi).  In the example below, we are connecting to a Pi called "matrixpi"



2 Responses

Py
Py

April 17, 2020

Thank sooo much for this post ! You made my day !

Jim Sutton
Jim Sutton

March 04, 2020

Really helpful post. I would not have been able to get afp working without this tip. I really appreciate the time you spent to write it up so cleanly..

BRAVO!

Leave a comment

Comments will be approved before showing up.


Also in News

Understanding the Differences Between Micro:Bit and Arduino
Understanding the Differences Between Micro:Bit and Arduino

February 24, 2021

The micro:bit and Arduino are two microcontroller products that are popular in the maker electronics community. Understand the differences between them here.

Continue Reading

Arduino: What It Is and What You Can Do With It
Arduino: What It Is and What You Can Do With It

February 15, 2021

Continue Reading

How To Use Raspberry Pi To Build a Retro Gaming Console
How To Use Raspberry Pi To Build a Retro Gaming Console

January 28, 2021

Using Raspberry Pi to make a gaming system is a popular project. We give you the steps to follow in order to turn your Raspberry Pi into a retro gaming console.

Continue Reading