Recent Posts

2019-06-29

Mac backups on Ubuntu 19.04 and Samba 4.10

Ubuntu 19.04 now contains samba 4.10, that should support all the SMB/CIFS extensions needed by MacOS to use the samba shares as TimeMachine storage. Tested with MacOS 10.14.5.

So let's do some TimeMachine backups on Ubuntu 19.04!

Assumptions:

  • your Ubuntu is running on some PC, with some fixed IP,
  • you have your Mac connected to the same network.

First install Samba:
apt install samba
Let's get the old samba config out of the way

mv /etc/samba/smb.conf /etc/samba/smb.confORG

Now create and edit /etc/samba/smb.conf (this is the same as in previous samba mac backups howto)

[global]
server role = standalone server
passdb backend = tdbsam
obey pam restrictions = yes
security = user
printcap name = /dev/null
load printers = no
socket options = TCP_NODELAY IPTOS_LOWDELAY SO_RCVBUF=524288 SO_SNDBUF=524288
server string = Samba Server %v
dns proxy = no
wide links = yes
follow symlinks = yes
unix extensions = no
acl allow execute always = yes
# Special configuration for Apple's Time Machine
fruit:model = MacPro
fruit:advertise_fullsync = true
fruit:aapl = yes
fruit:time machine = yes
## Definde your shares here
[backup]
path = /space/backups
valid users = backups
writable = yes
durable handles = yes
kernel oplocks = no
kernel share modes = no
posix locking = no
vfs objects = catia fruit streams_xattr
ea support = yes
browseable = yes
read only = No
inherit acls = yes


Create and edit /etc/avahi/services/timemachine.service (this is the same as in previous samba mac backups howto)

<?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=RackMac</txt-record>
</service>
<service>
<type>_adisk._tcp</type>
<txt-record>sys=waMa=0,adVF=0x100</txt-record>
<txt-record>dk0=adVN=backup,adVF=0x82</txt-record>
</service>
</service-group>

Add the backup directory, backup user and set permissions on the directory. This also sets the password for SMB/CIFS access:

useradd -m backups
smbpasswd -a backups
mkdir -p /space/backups
chown backups /space/backups
chmod 700 /space/backups

Now either reboot your Ubuntu or restart avahi and samba.

And there, the new backup destination should show up in all macs connected to the same network. REMEMBER KIDS, DO ENCRYPTED BACKUPS!

ps. how to view you mac backups progress:

log stream --style syslog --predicate 'senderImagePath contains[cd] "TimeMachine"' --info