Setting up SAMBA for Linux / MacOS The article describes configuring Samba on AlmaLinux 9.x for file sharing with macOS 15.x, replacing Netatalk. The author provides their `/etc/samba/smb.conf` configuration, highlighting the need to enable `kernel oplocks = yes` to resolve "text file busy" errors when editing scripts on a Mac and executing them on Linux. Additionally, the author includes their `/etc/nsmb.conf` settings for the Mac client to optimize SMB behavior. I recently re switched from using Netatalk to Samba for file access from macOS 15.x to linux AlmaLinux 9.x . Obviously the Samba is a great resource, on the Samba Wiki the Configure Samba to Work Better with Mac OS X was invaluable for setting up the /etc/samba/smb.conf file, and the vfs fruit man page contains documentation for all the options. Here is the /etc/samba/smb.conf file I use: See smb.conf.example for a more detailed config file or read the smb.conf manpage. Run 'testparm' to verify the config is correct after you modified it. https://www.samba.org https://www.samba.org/samba/docs/current/man-html/ https://www.samba.org/samba/docs/current/man-html/smb.conf.5.html https://www.samba.org/samba/docs/current/man-html/vfs fruit.8.html https://wiki.samba.org/index.php/Configure Samba to Work Better with Mac OS X /etc/samba/smb.conf global Server identification workgroup = LINUX server string = linux.internal Samba security = user Network interface bind interfaces only = yes interfaces = 10.0.1.150/24 Password backend passdb backend = tdbsam Always sync to disk optional sync always = yes Use extended POSIX ACLs inherit acls = yes Set default file & directory permissions create mask = 0664 directory mask = 0775 Linux supports kernel oplocks Apple changed something with their SMB client in macOS 13 Ventura causing it to place opportunitics locks on files being edited resulting in a 'text file busy' error on the Linux side when attempting to execute the script. Setting 'kernel oplocks = yes' works around this issue. Reported to Apple as FB11738061, reported as fixed? on Oct 16, 2025 Present in macOS 14 Sonoma Accessing Linux Samba 4.20.x Present in macOS 15 Sequoia Accessing Linux Samba 4.21.x Fixed? in macOS 26.2 Tahoe Accessing Linux Samba 4.22.x kernel oplocks = yes Added for Mac Client support https://wiki.samba.org/index.php/Configure Samba to Work Better with Mac OS X https://www.samba.org/samba/docs/current/man-html/vfs fruit.8.html min protocol = SMB3 ea support = yes 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 fruit:zero file id = yes printing = cups printcap name = cups load printers = yes cups options = raw homes comment = Home Directories valid users = %S, %D%w%S browseable = no writeable = yes printers comment = All Printers path = /var/tmp printable = yes create mask = 0600 browseable = yes print$ comment = Printer Drivers path = /var/lib/samba/drivers write list = @printadmin root force group = @printadmin create mask = 0664 directory mask = 0775 There is an option worth noting, Apple changed something with their SMB client in Ventura and I needed to add the 'kernel oplocks = yes' options because MacOS would place opportunitics locks on the files I was editing and I would get a 'text file busy' error on the linux side when I tried to run scripts. Setting 'kernel oplocks = yes' helped to work around this. Setting this option is only useful if you edit code on a Mac and execute this code on the Linux machine. I also made some changes to '/etc/nsmb.conf' on the Mac, here is the version I use: SMB Client Parameters: ---------------------- /etc/nsmb.conf Manual Page man nsmb.conf Adjust SMB browsing behavior in macOS https://support.apple.com/en-us/HT208209 How to disable SMB 1 or NetBIOS in macOS https://support.apple.com/en-us/HT211927 Configure SMB Multichannel behavior https://support.apple.com/en-us/HT212277 Disable local SMB directory enumeration caching https://support.apple.com/en-us/101918 Lots of useful information https://gist.github.com/jbfriedrich/49b186473486ac72c4fe194af01288be https://gist.github.com/Zahorone/6915be6f5088edb2f64018ce9e4dfe97 default Require SMB3 7 == 0111 SMB 1/2/3 should be enabled default . 6 == 0110 SMB 2/3 should be enabled. 4 == 0100 SMB 3 should be enabled. protocol vers map=4 SMB TCP/UDP ports: both: Attempt to connect via port 445. If that is unsuccessful, try to connect via NetBIOS default . netbios only: Do not attempt to connect via port 445. no netbios: Attempt to connect via port 445. If that is unsuccessful, do not try NetBIOS. port445=no netbios Turn on SMB client signing signing required=yes Set hard or soft mount of shares no: Hard mount - a request is issued repeatedly until the request is satisfied default . yes: Soft mount - tried until completed, the retry limit is met or the timeout limit is met. soft=yes Disable multichannel support if you have both Wi-Fi and wired networks mc on=no Some Wi-Fi networks advertise faster speeds than the connected wired network mc prefer wired=yes Apple SMB extensions: File IDs are legacy compatibility elements for AFP and are not supported by SMB. file ids off=yes Disable Directory caching. macOS will re-download the full contents of the folder s and metadata every time you browse an SMB share. dir cache off=yes Disable local SMB directory enumeration caching dir cache max cnt=0 ReadDirAttr: This feature changes how macOS handles reads of file metadata stored in alternate data stream when listing the contents of large directories. Finder info, access rights, and resource fork size are returned more efficiently for the files in the directory. ??? OsxCopyFile: With the SMB2 protocol, Microsoft implemented server-side optimizations when copying files between directories on the file share. The extension introduced by Apple ensures that all Apple-specific file metadata is properly copied along with the file itself. The copy process is also simplified as it is executed in just one request as opposed to splitting the requests into logical chunks which was the case in the original feature. aapl off=false