In many networks these days, you’ll probably have more than just Windows or Mac OS clients. If you regularly exchange data between Mac OS and Windows/Linux using a flash drive and have hidden files enabled, you may notice a bunch of .DS_Store folders and other various files beginning with a dot. Personally, I find it somewhat annoying that Mac OS litters whole file systems with these files (In the same way, I also hate those thumbs.db files Windows generates)
In a unified file server which serves multiple operating systems, we ideally want each client to have a good experience browsing for files. We don’t want Windows users to be bogged down in a mess of files they have no clue about, and we don’t want them accidentally deleting files which may be important to the Mac OS experience.
There are no adjustments which need to be made on your AFP shares, since only Mac OS clients access those shares and know what to do with these files. However, these files should be hidden on CIFS shares. Here’s how you do it in FreeNAS 8 (The solution applies to anyone using CIFS, not just in FreeNAS):
1. Navigate to your CIFS share and press edit
2. Find “Auxilary Parameters at the bottom”
3. Enter the following text in the box
veto files = /Temporary Items/.DS_Store/.AppleDB/.TemporaryItems/.AppleDouble/.bin/.AppleDesktop/Network Trash Folder/.Spotlight/.Trashes/.fseventd/
delete veto files = yes
hide dot files = yes
Vetoing a file will render it completely invisible to anyone accessing the share. It differs from hidden files in that hidden files are hidden on the client side, but vetoed files are hidden on the server side even before the list of files is sent to the client.
The first line veto files
specifies a list of file names to veto, each entry separated by a ‘/’, and you can also use wildcards (‘*’ and ‘?’) to specify multiple files with a single pattern.
“delete veto files
” allows CIFS to delete any vetoed files within a directory when that said directory is deleted. If this is not set to ‘yes’, deleting a directory could fail.
“hide dot files
” is optional, but simply sets all files beginning with a dot (which are hidden files in Mac OS and Linux) with a hidden flag.
4. Restart CIFS from your Services tab
If all is well, browsing your shares from all computers should now be a pleasant experience!
If you’re ever in doubt, or if you want to find out what other options can be entered, do check out the smb.conf documentation.