How to Set Up Time Machine Backups to a Linux Server (Samba as a Mac Backup Target)

Every Mac in the house should back up hourly, and the backup should be somewhere other than a drive plugged into the Mac. Samba (tutorial 31) can present a share that Time Machine accepts as a backup disk — Apple's own protocol tweaks are built into modern Samba — so the server becomes a Time Capsule, with a size limit per Mac and no Apple hardware required.
Quick reference
| Piece | What |
|---|---|
| Share | [TimeMachine] block with fruit:time machine = yes |
| Size cap per Mac | fruit:time machine max size = 1T |
| Folder | /mnt/data/timemachine/ owned by that Samba user |
| Discovery | avahi-daemon so the share appears in Time Machine's disk list |
| On the Mac | System Settings → General → Time Machine → Add Backup Disk |
| Check | tmutil destinationinfo and tmutil latestbackup on the Mac |
1. The share
A folder per person, so each Mac's backup is separate and capped:
sudo mkdir -p /mnt/data/timemachine/john
sudo chown john:john /mnt/data/timemachine/john
sudo chmod 700 /mnt/data/timemachine/john
(sudo smbpasswd -a john if that user isn't in Samba yet — tutorial 31.)
sudo nano /etc/samba/smb.conf
In [global], add:
min protocol = SMB2
vfs objects = fruit streams_xattr
fruit:metadata = stream
fruit:model = MacSamba
fruit:veto_appledouble = no
fruit:nfs_aces = no
fruit:wipe_intentionally_left_blank_rfork = yes
fruit:delete_empty_adfiles = yes
fruit:posix_rename = yes
At the bottom:
[TimeMachine]
path = /mnt/data/timemachine/%U
valid users = %U
read only = no
browseable = yes
fruit:time machine = yes
fruit:time machine max size = 1T
vfs objects = catia fruit streams_xattr
%U is the connecting user, so one share block serves everyone, each landing in their own folder. The max size tells Time Machine how much it may use; set it to roughly 1.5–2× the Mac's disk.
testparm
sudo systemctl restart smbd
2. Make it appear automatically
sudo apt install avahi-daemon -y
sudo nano /etc/avahi/services/timemachine.service
<?xml version="1.0" standalone='no'?>
<!DOCTYPE service-group SYSTEM "avahi-service.dtd">
<service-group>
<name replace-wildcards="yes">%h</name>
<service><type>_smb._tcp</type><port>445</port></service>
<service><type>_device-info._tcp</type><port>0</port><txt-record>model=TimeCapsule8,119</txt-record></service>
<service><type>_adisk._tcp</type><port>9</port>
<txt-record>sys=waMa=0,adVF=0x100</txt-record>
<txt-record>dk0=adVN=TimeMachine,adVF=0x82</txt-record>
</service>
</service-group>
sudo systemctl restart avahi-daemon
sudo ufw allow 5353/udp
The server now advertises itself with a Time Capsule icon on the network.
3. On the Mac
System Settings → General → Time Machine → Add Backup Disk. The server's TimeMachine share is listed; choose it, enter the Samba username and password, tick Encrypt backup if you like. The first backup runs now and takes hours over Wi-Fi — plug into Ethernet for it. After that, hourly increments are small.
If it isn't listed, connect manually first: Finder → Go → Connect to Server → smb://192.168.1.50/TimeMachine, then add the disk.
4. Check it's working
On the Mac:
tmutil destinationinfo
tmutil latestbackup
On the server, /mnt/data/timemachine/john/ contains a .sparsebundle that grows over time. Keep an eye on the data drive (df -h), and consider the SMART and backup tutorials — this is now the Mac's only backup, and the server's drive holding it needs its own protection (mirror or parity, tutorials 97–99).
Several Macs
A Samba user and folder per Mac (or per person), same share block. They can't see each other's bundles.
Troubleshooting
Share not listed in Time Machine. Avahi isn't advertising (avahi-browse -a | grep adisk from another Linux box), or fruit:time machine = yes is missing. The manual connect route always works.
"The backup disk image could not be created" / "not available". Permissions: the folder must be owned by the Samba user, and vfs objects must include fruit and streams_xattr on the share.
Backups fail after a while with verification errors. Usually Wi-Fi drops mid-write. Ethernet for the first backup; and on the server, fruit:time machine must be set (it enables the durable-handle behaviour Time Machine relies on).
Disk full on the server. max size too generous or several Macs. Lower it; Time Machine thins old backups to fit.
Wrapping up
A per-user folder, a [TimeMachine] share with the fruit options, an Avahi service file. Every Mac in the house backs up hourly to the server with no cables and no Apple box — and the server's own backup and mirror tutorials make sure that copy is safe too.
