{"slug": "setting-up-samba-for-linux-macos", "title": "Setting up SAMBA for Linux / MacOS", "summary": "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.", "body_md": "I recently (re)switched from using Netatalk to Samba for file access from macOS (15.x) to linux (AlmaLinux 9.x).\nObviously 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.\nHere is the /etc/samba/smb.conf file I use:\n# See smb.conf.example for a more detailed config file or\n# read the smb.conf manpage.\n# Run 'testparm' to verify the config is correct after\n# you modified it.\n#\n# https://www.samba.org\n# https://www.samba.org/samba/docs/current/man-html/\n# https://www.samba.org/samba/docs/current/man-html/smb.conf.5.html\n#\n# https://www.samba.org/samba/docs/current/man-html/vfs_fruit.8.html\n# https://wiki.samba.org/index.php/Configure_Samba_to_Work_Better_with_Mac_OS_X\n#\n#\n# /etc/samba/smb.conf\n#\n[global]\n# Server identification\nworkgroup = LINUX\nserver string = linux.internal (Samba)\nsecurity = user\n# Network interface\nbind interfaces only = yes\ninterfaces = 10.0.1.150/24\n# Password backend\npassdb backend = tdbsam\n# Always sync to disk (optional)\n# sync always = yes\n# Use extended POSIX ACLs\ninherit acls = yes\n# Set default file & directory permissions\ncreate mask = 0664\ndirectory mask = 0775\n# Linux supports kernel oplocks\n# Apple changed something with their SMB client in macOS 13 (Ventura) causing\n# it to place opportunitics locks on files being edited resulting in a\n# 'text file busy' error on the Linux side when attempting to execute the script.\n# Setting 'kernel oplocks = yes' works around this issue.\n# Reported to Apple as FB11738061, reported as fixed? on Oct 16, 2025\n# Present in macOS 14 (Sonoma) (Accessing Linux Samba 4.20.x)\n# Present in macOS 15 (Sequoia) (Accessing Linux Samba 4.21.x)\n# Fixed? in macOS 26.2 (Tahoe) (Accessing Linux Samba 4.22.x)\n# kernel oplocks = yes\n# Added for Mac Client support\n# https://wiki.samba.org/index.php/Configure_Samba_to_Work_Better_with_Mac_OS_X\n# https://www.samba.org/samba/docs/current/man-html/vfs_fruit.8.html\nmin protocol = SMB3\nea support = yes\nvfs objects = fruit streams_xattr\nfruit:metadata = stream\nfruit:model = MacSamba\nfruit:veto_appledouble = no\nfruit:nfs_aces = no\nfruit:wipe_intentionally_left_blank_rfork = yes\nfruit:delete_empty_adfiles = yes\nfruit:posix_rename = yes\nfruit:zero_file_id = yes\n# printing = cups\n# printcap name = cups\n# load printers = yes\n# cups options = raw\n[homes]\ncomment = Home Directories\nvalid users = %S, %D%w%S\nbrowseable = no\nwriteable = yes\n#[printers]\n# comment = All Printers\n# path = /var/tmp\n# printable = yes\n# create mask = 0600\n# browseable = yes\n#[print$]\n# comment = Printer Drivers\n# path = /var/lib/samba/drivers\n# write list = @printadmin root\n# force group = @printadmin\n# create mask = 0664\n# directory mask = 0775\nThere 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.\nI also made some changes to '/etc/nsmb.conf' on the Mac, here is the version I use:\n# SMB Client Parameters:\n# ----------------------\n#\n# /etc/nsmb.conf\n#\n# Manual Page\n# man nsmb.conf\n#\n# Adjust SMB browsing behavior in macOS\n# https://support.apple.com/en-us/HT208209\n#\n# How to disable SMB 1 or NetBIOS in macOS\n# https://support.apple.com/en-us/HT211927\n#\n# Configure SMB Multichannel behavior\n# https://support.apple.com/en-us/HT212277\n#\n# Disable local SMB directory enumeration caching\n# https://support.apple.com/en-us/101918\n#\n# Lots of useful information\n# https://gist.github.com/jbfriedrich/49b186473486ac72c4fe194af01288be\n# https://gist.github.com/Zahorone/6915be6f5088edb2f64018ce9e4dfe97\n#\n[default]\n# Require SMB3\n# 7 == 0111 SMB 1/2/3 should be enabled (default).\n# 6 == 0110 SMB 2/3 should be enabled.\n# 4 == 0100 SMB 3 should be enabled.\nprotocol_vers_map=4\n# SMB TCP/UDP ports:\n# both: Attempt to connect via port 445. If that is unsuccessful, try to connect via NetBIOS (default).\n# netbios_only: Do not attempt to connect via port 445.\n# no_netbios: Attempt to connect via port 445. If that is unsuccessful, do not try NetBIOS.\nport445=no_netbios\n# Turn on SMB client signing\nsigning_required=yes\n# Set hard or soft mount of shares\n# no: Hard mount - a request is issued repeatedly until the request is satisfied (default).\n# yes: Soft mount - tried until completed, the retry limit is met or the timeout limit is met.\n#soft=yes\n# Disable multichannel support if you have both Wi-Fi and wired networks\nmc_on=no\n# Some Wi-Fi networks advertise faster speeds than the connected wired network\nmc_prefer_wired=yes\n# Apple SMB extensions:\n# File IDs are legacy compatibility elements for AFP and are not supported by SMB.\n#file_ids_off=yes\n# Disable Directory caching. macOS will re-download the full contents of the\n# folder(s) and metadata every time you browse an SMB share.\ndir_cache_off=yes\n# Disable local SMB directory enumeration caching\ndir_cache_max_cnt=0\n# ReadDirAttr: This feature changes how macOS handles reads of file metadata stored in\n# alternate data stream when listing the contents of large directories. Finder info,\n# access rights, and resource fork size are returned more efficiently for the files\n# in the directory.\n# ???\n# OsxCopyFile: With the SMB2 protocol, Microsoft implemented server-side optimizations\n# when copying files between directories on the file share. The extension introduced by\n# Apple ensures that all Apple-specific file metadata is properly copied along with the file\n# itself. The copy process is also simplified as it is executed in just one request as\n# opposed to splitting the requests into logical chunks which was the case in\n# the original feature.\n#aapl_off=false", "url": "https://wpnews.pro/news/setting-up-samba-for-linux-macos", "canonical_source": "https://gist.github.com/fschiettecatte/02d61e3d36c5f8d36bd45586fc5d0dc7", "published_at": "2022-11-15 17:21:09+00:00", "updated_at": "2026-05-23 00:34:56.026753+00:00", "lang": "en", "topics": ["open-source", "enterprise-software"], "entities": ["Samba", "Netatalk", "macOS", "AlmaLinux", "Samba Wiki", "Mac OS X", "Linux", "Ventura"], "alternates": {"html": "https://wpnews.pro/news/setting-up-samba-for-linux-macos", "markdown": "https://wpnews.pro/news/setting-up-samba-for-linux-macos.md", "text": "https://wpnews.pro/news/setting-up-samba-for-linux-macos.txt", "jsonld": "https://wpnews.pro/news/setting-up-samba-for-linux-macos.jsonld"}}