Disable creation of .DS_Store files on samba shares

Don’t you hate it when your file server is filled with .DS_Store files and .TemporaryItems directories? .DS_Store files are hidden files created by Mac OSX in each directory you access with Finder and stores custom attributes of a folder like icon position and background images. Since they’re ‘custom’ and besides that they’re annoying, you don’t want single suctom settings to be applied to a network share. So let’s disable those.

Open up /etc/samba/smb.conf and add the following lines to each share:

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

Now restart samba.

Time to cleanup existing Mac OSX files! You can do that with this command:

find \( -name ".DS_Store" -or -name ".Trashes" -or -name "._*" -or -name ".TemporaryItems" \) -delete

You can also add the command above to a cron, to scan (f.e.) on a weekly base for these files.

Next to that, on your mac client, use this command to prevent any future creation of .DS_Store files on network shares:

defaults write com.apple.desktopservices DSDontWriteNetworkStores true

8 thoughts on “Disable creation of .DS_Store files on samba shares

  1. Pingback: On the topic of Mac Droppingsā€¦ | Bleeptek

  2. Thank you for this! I was getting seriously frustrated having to manually clean up all this Mac crap from my shares since letting my girlfriend browse with her Mac and getting an Air myself. Just tested it doing “touch ._hello” on a share and getting “touch: ._hello: Permission denied” as a response. Muhahahahaha! :D

    I can still create .Trashes and .TemporaryItems, though. Any particular reason you’re not doing,

    veto files = /._*/.DS_Store/.Trashes/.TemporaryItems/

    ?

    Thanks again! Love it :)

  3. Thank you so much for this information

    The samba related lead is exactly what I was looking for

    Give yourself a raise !!!

    Take care

    Steve

  4. Just had to leave a comment to say THANK YOU!! Those files have been bugging my network shares forever and thanks to this post I can 1) prevent the creation of them and 2) delete those already pestering my view. THANKS! :D

  5. you might want to add all these to your veto files list

    these are the veto file settings that Apple includes with its samba build on Mac OS X Server

    /icon?/TheVolumeSettingsFolder/.DS_Store/.TemporaryItems/TheFindByContentFolder/.FBCindex/.FBCIndexCopy/.localized/Network Trash Folder/Temporary Items/Cleanup At Startup/.FBCLockFolder/.Trashes/._*/

Leave a Reply

Your email address will not be published.

*