This tip applies to OS X when accessing a remote file system of various types (SMB, NFS, etc…). I was reminded of it while exploring my Windows Home Server.
Mac OS X will create a .DS_Store file in each directory when accessed through Finder (and in some other cases). These are hidden from OS X but can be visible under Windows. They have the hidden attribute but Windows can easily be set to display hidden files.
To prevent these files from being created open terminal and run:
defaults write com.apple.desktopservices DSDontWriteNetworkStores true
Then restart the Mac.
The setting is user specific and this Apple support article has information on how to copy the setting to other users along with some info on possible unexpected results, such as not displaying comments that were added to the file.
The .DS_Store file contains Finder properties such as view settings (and file comments). If want these settings saved for folders you can’t disable .DS_Store files. Creation of local .DS_Store files is not affected by this setting. The article is written for OS X 10.4 Tiger but I’m using it under OS X 10.5 Leopard without a problem.