Concisest guide to setting up Time Machine server on Ubuntu Server 12.04

How to quickly set up Time Machine server on Ubuntu Server 12.04 without using extra repositories, unnecessary packages and redundant configuration. Backing up tested on OS X 10.6 Snow Leopard and OS X 10.8 Mountain Lion.

Update: I haven’t tested myself, but comments suggest that these instructions work fine for Ubuntu Server 14.04 and backing up works even in OS X Yosemite.

If you need to install a new drive, follow the guide on Ubuntu Help.

1. That’s all you need to install:

sudo apt-get install netatalk avahi-daemon

2. Create a new user for Time Machine, for example, danny:

sudo adduser danny

3. Create a folder which will contain the backup. It doesn’t have to be located under /home or called “tm”.

mkdir -R /home/danny/tm/
chown -R danny /home/danny/tm/

4. Backup the configuration file:

sudo mv /etc/netatalk/AppleVolumes.default /etc/netatalk/AppleVolumes.default.old

5. Create a new configuration file and open it for editing:

sudo nano /etc/netatalk/AppleVolumes.default

Paste the following line which sets default settings for all shares:

:DEFAULT: options:upriv,usedots

Then add this line to share a folder with danny:

/home/danny/tm "Danny's Time Machine" options:tm volsizelimit:300000 allow:danny

Obviously “volsizelimit:300000″ limits the share to 300000 MiB (~314GB). (Finder will show “314GB available” when connected). Remove it if you want.

Important! Make sure you’ve replaced /home/danny/tm with the actual path you chose in step 3. Otherwise you’ll be getting OSStatus 2 errors later on.

6. Restart netatalk:

sudo service netatalk restart

7. Connect to your server using Finder (username “danny”). Open System Preferences > Time Machine, click “Select Disk…” and select your server under “Available Disks”:

time-machine-available-disksOnce again you’ll be asked for the login and password, after that you can disconnect from the share in Finder if you want, because Time Machine will open a new connection.

* * *

Bonus! Make your server appear as Xserve in Finder:


1. Open /etc/avahi/services/afpd.service for editing:

sudo nano /etc/avahi/services/afpd.service

2. Paste this:

<?xml version="1.0" standalone="no"?>
<!DOCTYPE service-group SYSTEM "avahi-service.dtd">

    <name replace-wildcards="yes">%h</name>


3. Restart avahi-daemon:

sudo service avahi-daemon restart

* * *

If avahi-daemon does not start after rebooting the server (so the server doesn’t re-appear in Finder’s sidebar), change AVAHI_DAEMON_DETECT_LOCAL from 1 to 0 in /etc/default/avahi-daemon (more information in my post on ServerFault). Note that if it never appeared in the first place, probably it has a different problem.

This entry was posted in How to’s and tagged , , . Bookmark the permalink.

33 Responses to Concisest guide to setting up Time Machine server on Ubuntu Server 12.04

  1. Jan-Cees Tjepkema says:

    Thanks alot man! It works great!

  2. Casey Friday says:

    I did this, and I’m getting an OSStatus Error 2 message, stating “Time Machine can’t access the backup disk”.

    Any ideas?

    • Dae says:

      Is your Time Machine share writable? (Can you upload a regular file via Finder into it?)

    • carlos perez says:

      Hi. I’m getting the same error.

      Did you figured how to solve it?
      The permissions are ok. I tried to copy a file into the shared folder using the same credentials and works ok..


  3. Marco says:

    hey dear,

    i did the same, but when i type user and password required by timemachine configuration i get this error message:

    There was a problem connecting to the server “lab.local”.

    Check the server name or IP address, and then try again. If you continue to have problems, contact your system administrator.

    let me know.


  4. Marco says:

    no, i can’t.. connection failed

  5. Marco says:

    Any suggestion?

  6. Andrew Zimmerman says:

    Thanks works fine,
    For those trying to figure it out I just simply did
    mkdir /home/timemachine/backup
    chmod 777 /home/timemachine/backup
    gave permissions for my username.

  7. John Walker says:

    Thank you for this post. I know there are a few comments from those that had problems, but I found it worked a treat using a big fat disk attached to an O2 Joggler running Ubuntu 12.10, with Time Machine running on Macs using OS X 10.7 Lion and 10.9 Mavericks.

    For both my back-ups I made sure that the only thing being backed up on the first round was a small folder. So you use Time Machine’s options dialog to exclude almost everything, then bring them in on subsequent back-ups. This just gets that first back-up done, so what follows is incremental.

    It did seem to take a long while at first to “locate” the backup disk, even though the share was listed instantly in the list of available disks for backup, it took ages to locate when actually backing up. To any who loose their nerve at this point, I suggest waiting before tweaking your settings and seeing if it completes. Thereafter it is quick.

    I haven’t tried restoring in earnest yet. But while I was migrating data from another backup on USB to a client’s mac, my Ubuntu Time Capsule was presented as a possible source of migration data in Migration Assistant.

  8. Sporkman says:

    Thanks for the nice description.

    I run an iptables-based firewall on my fileserver – what ports need opened for this setup?

    • Mir says:

      I see that three different protocols are used; samba, netatalk, avahi. I am guessing here but I would look for the ports these protocols use.

  9. Mir says:

    I got this to work and it great but I had two questions.

    First the initial backup is so long, I was considering to plug in my drive for the initial backup; can I then use that same backup on the server?

    Second can I do all this for another Mac device?

    • Dae says:

      can I then use that same backup on the server?

      I’ve heard that people do this, but I don’t know if there are any pitfalls.

      Second can I do all this for another Mac device?

      If you want to backup another computer, you can either:

      (1) Repeat step 6 on another Mac and use the same Linux user/password. This way, two Macs will be backed up to the same Time Machine share.

      This is easier, but not very secure: if you’re using Mac #1 and your friend is using Mac #2, you and your friend will be able to access files of each other through the backups.

      (2) If you want your Macs backed-up into separate shares, repeat step 2 and step 4. In Step 4 obviously you may skip the “Paste the following line” part because you should already have that line in your AppleVolumes.default file.

  10. Cameron says:

    This is working great for me. Thanks for the instructions. Question though: does anybody know if there any way to read the backed up files from the Ubuntu machine if the Mac dies? I’ve been looking at instructions such as

    but the folder names and structure mentioned there don’t seem to be the same. It seems that things are stored differently.


    • Dae says:

      I’m not sure I understand the part about folder names. My guide does not impose any specific folder structure.

      Keep in mind that OS X stores its backup in a “.backupd” file, that is a container with Apple’s proprietary HFS+ filesystem. By default Ubuntu cannot read HFS+ and thus it cannot read your “.backupd” container, until you specifically tune it to do so with additional packages and hacks, as suggested by your link.

  11. robert says:

    thanks, so simple. I had Tiger backing up to Ubuntu, but when I went to Snow Leopard it stopped and I couldn’t get it working again until I came across this. Now the mac is backing nicely and I go access back to those original backups from the tiger days!

  12. Pingback: CentOS: Instalar o Netatalk 3.1.0 (Time Machine) | Blog do TadeuCruz

  13. Moosila says:

    This is great help. Thank you.

    Andrew Zimmerman, Thanks for the solution!

  14. Gary Corcoran says:

    I think the below commands are needed to be run on Mavericks, they were for me anyway,
    cd /usr/lib/netatalk
    ln -s

  15. Pingback: Jeff Beard » Blog Archive » Store Time Machine Backups on an Ubuntu Server -

  16. James says:

    If you getting the “OSStatus Error 2 message” message with an external drive try not auto-mounting the drive but instead use a system wide mount by editing fstab or using pysdm to do that.

  17. George says:

    This is great. I have everything working (Yosemite) however ,when I try to connect to the volume it will not connect. I tried logging in with the user ID I setup for time machine and the password did work. I see the drive I even have the icon changed to the server, but it will not connect to the drive. I’m sure it’s a ID10T error but any input would be great – Thank you.

  18. Ronald says:

    Does what it says on the tin: “without using extra repositories, unnecessary packages and redundant configuration”. Took less than 5 minutes to set up. Confirmed on Ubuntu 14.04.1 LTS and Yosemite. Even added –no-install-recommends to the apt-get install command to skip some more packages that are apparently unneeded.

  19. Viktor Basso says:

    This guide helped me set up a Time Capsule share and add AFP to my NAS.
    Thank you very much!

  20. Simple, clear and… IT WORKS on 14.04.

  21. Ray says:

    Thanks for the guide! Mac is being backed up right now. An OSStatus 2 error was happening when first trying. Then came the realization of an ID10T error of actually pasting /path/to/shared/folder instead of creating, setting permissions and inputting my own path :). Thanks again!

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>