For quite some time I use my Linux machine as a file and backup server (Mac File Server and Time Machine Volume) for all Mac’s in my network which is accessible from the Finder in Mac OS X.
We will use the following packages to implement the needed features on Linux mashine:
- The analogue of the
Apple Filing Protocol (AFP)in Linux is the
- The analogue of the
Bonjourin Linux is the
Install and configure Netatalk
Netatalk is the Open Source implementation of AFP.
sudo apt-get install netatalk
First we should deactivate services provided by Netatalk which are not needed.
sudo nano /etc/default/netatalk
Locate the following startup options and change them as noted below:
ATALKD_RUN=no PAPD_RUN=no CNID_METAD_RUN=yes AFPD_RUN=yes TIMELORD_RUN=no A2BOOT_RUN=no
Configure shared Volumes
Now we have to tell the afpd daemon what volumes we want to share.
sudo nano /etc/netatalk/AppleVolumes.default
Scroll to the bottom of the document and define your shared volumes:
~/ "Home Directory"
You can setup as many shared volumes as you wish. You can even define which users are allowed to access each share. You do this using the allow option.
On my server, I have the following setup for my external drive.
~/Drive/ "Drive" allow:arthur,milena
Since you’ll probably want to use your file server as a time machine backup, we can also define a volume just for that. Create a directory
TimeMachine, and set it up using the following line.
~/Drive/TimeMachine "TimeMachine" allow:arthur,milena options:tm
Finally restart Netatalk to activate the changes:
sudo /etc/init.d/netatalk restart
Now we have a fully configured AFP it will not show up in the Finder sidebar on OS X, it is however reachable via
Connect to Server in Finder.
Install and configure Avahi
OS X use a service called Bonjour for automatic discovery, which displays the server on your sidebar. Linux can emulate this functionality with an open source implementation of Bonjour called Avahi.
sudo apt-get install avahi-daemon
Create a xml-file for the afpd service with the following line:
sudo nano /etc/avahi/services/afpd.service
<?xml version="1.0" standalone='no'?><!--*-nxml-*--> <!DOCTYPE service-group SYSTEM "avahi-service.dtd"> <service-group> <name replace-wildcards="yes">%h</name> <service> <type>_afpovertcp._tcp</type> <port>548</port> </service> <service> <type>_device-info._tcp</type> <port>0</port> <txt-record>model=TimeCapsule</txt-record> </service> </service-group>
Restart the avahi daemon to activate all changes:
sudo /etc/init.d/avahi-daemon restart
Now you have configured the Avahi daemon to advertise AFP sharing across your network which will cause your Linux machine to show up in Finder’s sidebar.
Configure Time Machine on Mac OS
Just choose a TimeMachine volume as the backup disk in the Time Machine system preferences. That’s it!
If this article has helped you then please leave a comment
Thanks for reading!