Samba settings for MacOS and Time Machine backups

Sunday Sep 12, 2021 | linux, macos

Update 01.02.2022: A bug has been found in Samba in regards to MacOS extended attributes that can be exploited to gain root access, see CVE-2021-44142 for details. Following Samba versions were patched: 4.13.17, 4.14.12, 4.15.5 and all versions greater than 4.16

Important: you need Samba 4.9 (released September 13, 2018) or newer, so if you are using Fedora 29 or later or Ubuntu 19.04 or newer you should be good.

Check your installed Samba version with smbd --version

The config file for Samba is located in /etc/samba/smb.conf

# These are MacOS specific optimizations for Samba, this is NOT a complete smb.conf
[Global]
min protocol = SMB2
vfs objects = fruit streams_xattr  
fruit:metadata = stream
fruit:model = MacSamba
fruit:posix_rename = yes
fruit:veto_appledouble = no
fruit:wipe_intentionally_left_blank_rfork = yes
fruit:delete_empty_adfiles = yes

# This is the share configuration for the Time Machine Backup
[TimeMachineBackup]
vfs objects = fruit streams_xattr
fruit:time machine = yes
#  fruit:time machine max size = SIZE

Per default all available disk space is reported to Time Machine. If you want to limit the reported space you can use fruit:time machine max size in the share configuration. The size can be specified in Kilobyte (K), Megabyte (M), Terabyte (T) or Petabyte (P).

Example with 100 Gigabyte:

# This is the share configuration for the Time Machine Backup
[TimeMachineBackup]
vfs objects = fruit streams_xattr
fruit:time machine = yes
fruit:time machine max size = 100G

Automounting Samba share

https://serverfault.com/questions/809582/automount-smb-drive-on-osx