Disable the creation of .DS_Store on SMB shares
.DS_Store files are automatically created by macOS and contain metadata of folders custom attributes. Follow the steps below to disable their creation on SMB shares.
- On your Samba server, edit your smb.conf file, add the lines below to each available share and restart the Samba service:
veto files = /._*/.DS_Store/
delete veto files = yes
- As an alternative, prevent macOS from reading .DS_Store files to improve browsing of the shared folders. Run the following command on your macOS terminal.
defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool TRUE
More information at Adjust SMB browsing behavior in macOS High Sierra 10.13 and later
- Last but not least, remove the pesky files from any existing folders:
find \( -name ".DS_Store" -or -name ".Trashes" -or -name "._*" -or -name ".TemporaryItems" \) -delete