Skip to content

Instantly share code, notes, and snippets.

@jasonacox
Last active October 6, 2024 20:57
Show Gist options
  • Save jasonacox/c74eb7c5f0d2fa14a1a9033a45c3f1c5 to your computer and use it in GitHub Desktop.
Save jasonacox/c74eb7c5f0d2fa14a1a9033a45c3f1c5 to your computer and use it in GitHub Desktop.
Linux Ubuntu 24.04 Samba for MacoS Time Machine

Time Machine Backups using Samba on Ubuntu 24.04

Use Ubuntu 24.04 server as a Time Machine backup host for MacOS computers.

Introduction

In the past I set up netatalk on our Linux servers to provide Apple Talk shares on the network. However, I discovered Stefan Johner's post on usig Samba with the vfs_fruit module. The Samba package provides SMB compatible file sharing which means it works with a variety of operating systems and devices, including Windows and MacOS. The vfs_fruit module allows it to offer up those shares as Time Machine compatible destinations.

Setup

  1. Install Samba
# Install
sudo apt update
sudo apt install samba
  1. Edit Configuration File
# Edit smb.conf
sudo nano /etc/samba/smb.conf

First, add the vfs_fruit configs under Global:

[global]
# Fruit global config
  fruit:aapl = yes
  fruit:nfs_aces = no
  fruit:copyfile = no
  fruit:model = MacSamba

Next, select the folders you want to share and configure them for Fruit. Make sure you update the lines to match your setup, specifically the "valid users" and "path". The header (e.g. [timemachine]) is how the share will appear on your network (Apple Finder).

#======================= Share Definitions =======================

[timemachine]
  # Load in modules (order is critical!)
  vfs objects = catia fruit streams_xattr
  fruit:time machine = yes
  fruit:time machine max size = 300G
  comment = Time Machine Backup
  path = /mnt/timemachine
  available = yes
  valid users = timemachine
  browseable = yes
  guest ok = no
  writable = yes

Some posts or guides have you continue on to set up avahi but in my experience, that is not necessary for Ubuntu 24.04.

  1. Create Folders

Make sure you create the paths that you mention above and make sure the valid users have access to it:

# Make directory
sudo mkdir /mnt/timemachine

# Onwership
sudo chown -R timemachine:timemachine /mnt/timemachine
sudo chmod -R ug+rw /mnt/timemachine
  1. Restart
# Restart Service
sudo service smbd restart

# Allow Firewall if Active
sudo ufw allow samba
  1. On MacOS

In your Time Machine settings, add a disk and you should see the timemachine share appear:

image

References

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment