Prevent Mac hidden files being written to a shared storage

MacOS tends to trash mounted disks with number of useless hidden files (e.g.  ._* or .DS_Store ). There were number of recipes in the Internet, some of them were working at some of time but are not anymore.

Below notes from my fights (at a moment of writing, on MacOS High Sierra 10.13.4 (17E199).

Removing the files when they are created

I used to apply a find . -name ... -print0 | xargs rm -0  combo but found that there is an built-in command to deal with these files:

From the man:

Preventing creating the files

On the MacOS side

NOTE: None of these solutions worked for me!

As I wrote, this didn’t work at all to me.

On the SMB server side

It actually turned the only working solution for me. Just add to the share configuration section a veto file parameter, e.g.:

And restart:

Note, after applying this change you will not be able anymore to use dot_clean  command from your Mac as any requests towards these files (including deletion) will be silently ignored by your SMB server hence files will remain untouched!

Prevent Mac hidden files being written to a shared storage
Tagged on:     

Leave a Reply

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