fbpx

Most orders for IN STOCK items placed by 12PM CST M-F ship SAME DAY. Orders for custom items and prints may take additional time to process.

Block .DS_Store Files on a Synology NAS

If you’re like most system administrators who have a mixed Windows, Linux, and Mac environment it probably drives you mad (and your users too) that there are these “.DS_Store” files all over your network shares. These files are used by MacOS to store custom attributes about a folder layout. Such as sort order, position and size of icons, and even a custom background file for this folder.  This is fine if your entire network is made up of Macs, but for those with PCs it clutters up your shares everywhere and is super irritating.  So in this tutorial I am going to show you how to block .DS_Store files on a Synology NAS permanently, and also show you how to make your Macs be better citizens on the network too.  I’ll also show you how to clean up these existing .DS_Store files.

How to Block .DS_Store Files on a Synology NAS

Alright, before we begin, I highly recommend that you do this during a time of low usage by your user community. For several reasons:

  • You don’t want users creating more .DS_Store files as your deleting them, that’s an effort in futility.
  • When we block them, files that get created during this process will become sort of ghost files that will haunt you later on when deleting directories.
  • You will most likely have to restart the SMB service on your Synology NAS which will cause a blip to user access.

You may want to consider disabling all user access to the Synology during this time period and just tell your users you’re going to be doing maintenance for a bit.

Deleting the .DS_Store Files from the Synology NAS

The first thing we need to do is delete all of the existing .DS_Store files from our NAS. This can be done in multiple ways.  We’ll cover each of them.

Deleting the .DS_Store Files using a Mac or Linux

If you want to delete these .DS_Store files from MacOS or Linux, you can attach the share and run the following command:

find /YourShareName -name ".DS_Store" -delete

This uses the find command to search the shared folder and actions it with the delete option to remove it.  You can also SSH into your Synology NAS and run this command at the command line if you know the location of the share within your volumes and have SSH enabled.

Deleting the .DS_Store Files using a PC

If you want to delete these .DS_Store files from a PC running Windows, you can map the share and run the following commands:

cd D:\Your Folder
del /s /q /f /a .DS_STORE

This simply changes to the directory of your mapped share (change D:\ to your drive letter).  Del with this switches will force a deletion without asking and search all subfolders for the files.

Using Veto Files to Block .DS_Store on a Synology NAS

Now that we have all of the existing .DS_Store files deleted, it’s time to put in place a mechanism on the Synology to prevent them from returning.  Samba supports a mechanism called “Veto Files” and Synology supports this in DSM. It’s a simple way to block or hide files on your shares.

Open the web interface of your Synology NAS and then open the Control Panel application.

Open Synology Control Panel

From there click on File Services.

Synology File Services

Now click on Advanced Settings under SMB. About half way down on this page you will see an option for “Veto files”.  Check this box. Under “Veto criteria” enter “/.DS_Store/”.  This will tell the Synology to block the creation of any new .DS_Store files.  (Note: If any .DS_Store files are already on the drive they will become hidden. This is the problem we mentioned above and why we don’t want users creating new files when turn this on.)

Synology VETO FILES

And that’s all there is to that. You’ve learned how to block .DS_Store files on a Synology NAS!

RELATED: About my Synology RS2416+ and a review!

Making your Macs Better Network Citizens

If you’d like to take this a step further, or you’ve got NAS appliances or other SMB files shares on your network that do not support Veto files, you can tell your Macs to behave nicely and treat your network shares better.  This option simply forces your Macs to stop creating .DS_Store files in the first place, so there is no need to block them.

The only problem with this method is that this configuration needs to be changed on every single Mac in your environment, and also made to new Macs before they are placed on your network. This might be a problem if you have friends (or contractors in a corporate environment) who bring their own Macs and place them on your network. All it takes is one mis-configured Mac and .DS_Store files are everywhere again.  The solution here is to have an MDM tool like Airwatch or Intune that pushes this configuration and enforces it to all devices on your network.

On each Mac, run the following command to disable the creation of .DS_Store files on SMB shared folders:

defaults write com.apple.desktopservices DSDontWriteNetworkStores true

Reboot your Mac and it will no longer create remote .DS_Store files on SMB  shares. This doesn’t affect local files.


Upgrade to Premium

If you like our content maybe consider upgrading to Premium. You’ll get access to

  • Free access to all plans
  • Member only videos
  • Early access to content
  • Ad free Experience
  • Discounts on store merch
  • Direct hotline contact form

7 Responses

  1. Nice thanks. The .DS_store files also get you in problems when backup up to Synology since they sometimes are copied and sometimes arn’t. Doing a folder compare of a large folder structure after coping delivers a mismatch and a long search to find out it are there’s files.

  2. Now if there only was a way to auto-delete those pesky “System Volume Information” folders that Windows is obsessed about for some reason.

Leave a Reply