This post may be useful to anyone using SMB to share files to Windows users, but is particularly important to Leopard Server users because of the way OS X uses hidden files in the file system.

In the office we have a Mac Pro running Leopard Server.  This machine acts as (amongst other things) a file server, providing a common area for sharing files (that are backed up as I’ve discussed previously).

OS X users can access the server using AFP or SMB, and Windows users use SMB.  I was whinging to a colleague that Windows keeps leaving these files around that we can see when sharing the drive – those files being:

  • Thumbs.db
  • ~$* files
  • *.tmp files
  • Rescued Document* files

He pointed out that that was nothing compared to the sheer number of files Apple’s AFP and OS X leaves behind:

  • .DS_Store
  • .localized
  • .AppleDouble folders
  • ._* files
  • .TemporaryItems

That’s a whole lot of dot files that OS X users never see because dot files by default are hidden from the user (as they are in any Unix/Linux implementation). However, Windows doesn’t use that convention.

I logged in via Windows and he was right – the file system was a mess. I felt sorry for the Windows users (more than I usually do just because they are Windows users).

So, anyway, to cut a long story short, here’s the fix.  On Leopard Server, edit the file /etc/smb.conf from a Terminal window – something like:

sudo vi /etc/smb.conf

Add the following two lines to the [global] section of the file, and save the file:

veto files = /.*/Thumbs.db/
delete veto files = yes

From the Server Admin application, restart SMB.

Now, anyone connected via SMB to the shared file system will no longer see the dot files or the Thumbs.db files.

This doesn’t fix the issue with Microsoft Office leaving ~$* files everywhere, or Windows *.tmp files.  You could hide them by adding them to the veto file list, but you probably don’t want to just hide the files as they are quite large. I’m thinking I might write a script that automatically removes these files once they are older than a few days, to try and keep things clean.  If you have such a script, then you could hide the other files too.

SMB, Windows, and Leopard Server

6 thoughts on “SMB, Windows, and Leopard Server

  • January 11, 2009 at 7:56 pm
    Permalink

    Hey Jamie,

    You’ll actually find that Thumbs.db is a hidden file in Windows as I suspect the other files are too that you listed.

    1. Click ‘Start’.
    2. Open ‘My Computer’.
    3. Select ‘Tools’ menu
    4. Click ‘Folder Options’
    5. Select the ‘View’ Tab.
    6. Uncheck ‘Show hidden files and folders’ in the Hidden files and folders section.
    7. Select ‘Hide protected operating system files (recommended)’ option.
    8. Check the ‘Hide file extensions for known file types’ option.
    9. Click ‘Yes’.
    10. Click ‘OK’.

    You’re welcome.

    Grant.

  • January 12, 2009 at 8:17 am
    Permalink

    Thanks Grant. My solution though doesn’t require each machine to be set up correctly to not show hidden files, and prevents people on those machines from messing with files they shouldn’t mess with (if they try to show hidden files). SMB just won’t give them the files, even if they ask nicely.

  • January 12, 2009 at 11:03 pm
    Permalink

    Hey Jamie

    I ran into a similar problem with my Mac on a Microsoft network and found:

    http://support.apple.com/kb/HT1629

    This little tip did make the network admin I worked with much happier as he didn’t like the idea of running scripts over large network shares to clean up my trails.

  • January 18, 2009 at 11:59 am
    Permalink

    How’d one do a similar thing for the hidden “icon\r” files which OS X uses for custom folder icons?

  • January 18, 2009 at 4:22 pm
    Permalink

    Have you tried adding “icon\r” to the end of the “veto files” section, followed by an extra / to end the statement?

  • September 28, 2009 at 12:47 pm
    Permalink

    The FILES section of the manpage for `smbd’ may give some hints. You can do also the test parameter commands like this # vi /etc/samba/smb.conf

Leave a Reply

Your email address will not be published.

*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Anti-spam image