Prevent Macs from creating annoying .DS_Store files on Samba file servers

Prevent Macs from creating annoying .DS_Store files on Samba file servers

November 23, 2018 Uncategorized 0

If you have a network file server and you let a Mac touch it over the network, chances are very high that you’ve noticed a lot of file pollution caused by the Mac, mostly in the form of files called .DS_Store and ._.DS_Store in every single folder the Mac browses to. There are other hidden special files that may appear, but the .DS_Store files are by far the most prolific. While the files are harmless, they can be quite annoying and often end up in unexpected places such as Zip archives.

There are two approaches to fix this. The easiest way (if you have control over the Macs touching the server) is to have the user(s) each open Terminal (under Applications – Utilities) and type this command:

defaults write com.apple.desktopservices DSDontWriteNetworkStores true

This will disable the creation of .DS_Store and ._.DS_Store files on network servers for that user. However, if you can’t control the Macs or don’t want to go to each one and make the change, you can tell Samba to reject the creation of Mac special files instead. The most common example you’ll see around the internet looks like this (add these lines to the [global] section of your smb.conf file, or to individual share definitions if you prefer):

veto files = /._*/.DS_Store/
delete veto files = yes

Be aware that use of the “veto files” option can slow down your Samba server because every file and directory that is touched must be checked against this list. The client-side solution is a better choice if possible.

 

Leave a Reply

Your email address will not be published. Required fields are marked *