Setting Up a Time Machine Backup Server for macOS on Ubuntu

A spare Ubuntu computer can become a practical Time Machine destination for one or more Macs. With Samba and Avahi, the machine can offer an SMB network share that macOS discovers through Bonjour, allowing automatic backups without buying a dedicated NAS.

This approach suits a home office, a small studio, or a family with Macs and Linux hardware already available. It also gives you control over storage and software, although it requires careful configuration and a realistic backup plan. A network share in the same house will not protect data from theft, fire, flood, or a failed disk by itself.

Choose Suitable Hardware And Storage

The Ubuntu server does not need a powerful processor. A recent mini PC, an older desktop, or a low-power Intel or AMD system is usually sufficient. For a household in Sydney, Melbourne, or Brisbane, a wired Ethernet connection to the router will generally provide a more dependable backup path than Wi-Fi, especially when several devices are active.

Storage matters far more than CPU performance. Use a dedicated internal disk or a USB 3 hard drive with enough capacity for the Macs being backed up. A MacBook with a 1 TB internal drive may produce a Time Machine backup considerably larger than its current occupied space, because macOS keeps historical versions. A 2 TB disk can work for one lightly used Mac, while several Macs may justify 4 TB or more.

Use a Linux-native filesystem such as ext4 for the backup volume. Avoid placing the Samba share on a removable FAT32 disk, where file permissions and extended attributes can cause problems. If you buy a drive from an Australian retailer such as Officeworks or JB Hi-Fi, check whether it is intended for continuous operation; a desktop external drive is preferable to a tiny portable model for a server that runs all day.

Prepare Ubuntu And A Stable Network Address

Install a supported Ubuntu release, preferably Ubuntu 24.04 LTS or a later supported LTS version. Give the server a descriptive hostname, such as backup-server, and install updates before configuring file sharing:

sudo apt update
sudo apt full-upgrade
sudo hostnamectl set-hostname backup-server

A fixed address makes the server easier to troubleshoot. The best method is usually a DHCP reservation in the home router, rather than manually setting a static address inside Ubuntu. Reserve an address such as 192.168.1.20 for the server using the router’s administration page. Router interfaces differ between providers, including Telstra, Optus, and other Australian NBN services, so the exact menu name may be “LAN”, “DHCP”, or “Address Reservation”.

Connect the server to the router with Ethernet where possible. A backup can continue over Wi-Fi, but a wired connection avoids many discovery and throughput problems. Confirm the address and hostname before continuing:

hostname
hostname -I

If Ubuntu has a firewall enabled, allow local Samba traffic. The uncomplicated firewall profile is convenient:

sudo ufw allow 'Samba'
sudo ufw status

Do not expose Samba to the internet by forwarding ports from the router. Time Machine should be available only on your trusted home network or through a properly configured VPN.

Install Samba And Create A Dedicated Account

Install Samba and Avahi, the Linux implementation commonly used for Bonjour service discovery:

sudo apt install samba avahi-daemon
sudo systemctl enable --now smbd nmbd avahi-daemon

Create a separate Linux account for Time Machine. It should not be your everyday Ubuntu login and should not have shell access:

sudo adduser --shell /usr/sbin/nologin timemachine
sudo smbpasswd -a timemachine

Choose a strong password when prompted. The password used by macOS for the network share is the Samba password, which may be different from the Ubuntu administrator password.

Create a dedicated directory and assign ownership to the new account. The example assumes that the backup disk is mounted at /srv/timemachine; create the directory if it does not yet exist:

sudo mkdir -p /srv/timemachine
sudo chown timemachine:timemachine /srv/timemachine
sudo chmod 700 /srv/timemachine

For a separate disk, add its UUID to /etc/fstab so it mounts consistently after a restart. Find the UUID with lsblk -f. Mounting the disk at the wrong path is a common mistake: Samba may continue offering an empty directory while the real backup disk remains unmounted.

Configure An SMB Time Machine Share

Back up the Samba configuration before editing it:

sudo cp /etc/samba/smb.conf /etc/samba/smb.conf.original
sudo nano /etc/samba/smb.conf

Add or adjust the global settings, then create a share at the end of the file. The following configuration enables Apple-compatible metadata handling and identifies the share as a Time Machine target:

[global]
   workgroup = WORKGROUP
   server string = Ubuntu Time Machine Server
   security = user
   server min protocol = SMB2
   ea support = yes
   vfs objects = fruit streams_xattr
   fruit:aapl = yes
   fruit:metadata = stream
   fruit:model = MacSamba
   fruit:posix_rename = yes
   fruit:advertise_fullsync = yes

[Time Machine]
   path = /srv/timemachine
   browseable = yes
   read only = no
   valid users = timemachine
   inherit permissions = yes
   ea support = yes
   vfs objects = fruit streams_xattr
   fruit:time machine = yes

The fruit module is important because macOS uses Apple-specific metadata and filesystem behaviour. streams_xattr stores alternate data streams in extended attributes, while fruit:time machine tells Samba to treat the share as a Time Machine destination.

Check the syntax before restarting services:

testparm
sudo systemctl restart smbd nmbd

If testparm reports an unknown parameter, check the installed Samba version and remove only the unsupported option. Do not ignore syntax errors. A share that appears in Finder can still fail during the first backup if extended attributes or permissions are incorrect.

Publish The Server Through Bonjour

macOS normally finds network backup destinations through Bonjour. Avahi can advertise the Samba share using an Apple Disk Service record. Create the service definition:

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

Insert this XML:

<?xml version="1.0" standalone="no"?>
<!DOCTYPE service-group SYSTEM "avahi-service.dtd">
<service-group>
  <name replace-wildcards="yes">%h</name>
  <service>
    <type>_adisk._tcp</type>
    <port>9</port>
    <txt-record>sys=waMa=0,adVF=0x100</txt-record>
    <txt-record>dk0=adVN=Time Machine,adVF=0x82</txt-record>
  </service>
</service-group>

Restart Avahi and confirm that it is active:

sudo systemctl restart avahi-daemon
systemctl status avahi-daemon --no-pager

The advertisement name does not have to match the Samba share name, but keeping “Time Machine” in the label makes it easier to recognise. If the Mac does not discover the destination, test basic connectivity first by opening Finder, selecting Go, then Connect to Server, and entering:

smb://backup-server/Time%20Machine

You can also use the server’s IP address, such as smb://192.168.1.20/Time%20Machine. If the IP works but the hostname does not, investigate local DNS or router name resolution. If neither works, check the firewall, Samba status, account password, and directory ownership.

Connect macOS And Set A Backup Limit

On a current Mac, open System Settings, select General, then Time Machine, and choose Add Backup Disk. The Ubuntu share should appear after Bonjour finishes updating. Select it, choose Connect, and enter the timemachine Samba username and password.

If the share is visible in Finder but absent from Time Machine, the Avahi advertisement or Samba fruit settings are usually responsible. Disconnect any manually mounted copy, restart Avahi, and try the Time Machine panel again. macOS may create a sparsebundle image inside the share; this is normal and should not be renamed or edited.

A dedicated share prevents ordinary files from competing with backup data. You can also cap the amount of space that Time Machine may consume by adding a Samba fruit size setting when supported by the installed Samba release:

fruit:time machine max size = 1800G

Place it inside the [Time Machine] section, then run testparm and restart Samba. Leave free space for filesystem overhead and other backups. The exact supported syntax can vary between Ubuntu releases, so verify the parameter in man vfs_fruit if Samba rejects it.

The first backup may take many hours over a home network. A MacBook in Perth connected through Wi-Fi may appear to pause while it scans files, while the actual transfer is limited by the wireless link or the server disk. Keep the Mac connected to power for the initial run and avoid interrupting it unnecessarily.

Make The Backup Resilient And Private

A Time Machine server protects against accidental deletion, damaged macOS installations, and some hardware failures. It does not protect against a dead backup disk. Use SMART monitoring where supported and inspect the disk regularly:

sudo apt install smartmontools
sudo smartctl -a /dev/sdX

Replace /dev/sdX with the correct disk, not a partition. A UPS is useful for a server and external drive because brief power interruptions can occur during summer storms or outages. In parts of regional New South Wales, Queensland, and Victoria, longer outages and extreme weather also make an off-site copy especially valuable.

Keep at least one additional backup outside the Ubuntu server. This might be a second drive stored at another location, an encrypted cloud backup, or a rotated drive kept away from the home. Someone working from a home office in Adelaide should treat client documents and personal information carefully; Australian Privacy Principles may also be relevant for business data. Time Machine network traffic is local, but the server still stores sensitive files in a form that deserves proper protection.

Limit access to the dedicated account and keep Samba off public networks. Update Ubuntu and Samba regularly, use a strong unique password, and avoid sharing /srv/timemachine with general guest access. If family members need access from different Macs, they can use the same restricted account, although separate users and shares provide better accountability.

Test Restores Before Trusting The Server

After the first backup completes, open the Time Machine interface and browse several older snapshots. Restore a small document to a temporary folder, then open it. This verifies more than a successful progress bar: it checks that macOS can read the backup, Samba can return metadata, and the stored files are usable.

Test after a restart as well. Reboot the Ubuntu server, confirm that the storage disk mounted at /srv/timemachine, and ensure the Samba and Avahi services started automatically. A missing mount can result in backups being written to the operating system disk, quickly filling the root filesystem.

Monitor available capacity with:

df -h /srv/timemachine
sudo du -sh /srv/timemachine

Time Machine normally removes older snapshots when space becomes scarce, but a badly sized disk can still lead to failed backups. Check the share after macOS upgrades, Ubuntu upgrades, and changes to the router. The first restore test should happen now, while the configuration is fresh, rather than during an emergency.

An Ubuntu Time Machine server is most useful when it becomes routine infrastructure: powered on, connected by Ethernet, updated, and checked periodically. Begin with the dedicated disk and restricted Samba account, connect one Mac, and confirm a real file restoration. Before relying on the setup, run that restore test after the first completed backup and record the server’s address and login details in your household’s secure password manager.