I'm using ubuntu server 10 and I have this configuration in my smb.conf:
[www]
comment = Web files
path = /var/www
browsable = yes
writeable = yes
create mask = 0775
directory mask = 0775
valid users = @developers
When I connect trough MAC OSX machine and create a file or directory the permissions are set with 755.
Why?
How this works appears to change depending on whether you connected to the share using a "cifs://" or "smb://" URL (i.e. whether the location you type in to the Finder's "Connect to server" dialog begins with "cifs" or with "smb").
If you connect using a "cifs://" URL, then OS X will attempt to use the "UNIX extensions" described in other answers here, and files copied or moved to the share will retain the permissions they had on the source drive, no matter what the various permission masks/modes settings are for the share. I think this is probably due to a bug in Samba (I'm using 3.5.6 from Debian Squeeze - 2:3.5.6~dfsg-3squeeze8 if anyone is interested).
If however you connect using an "smb://" URL, the UNIX extensions will not be used, and the permissions will be dictated by the following settings for files:
force create mode, create mask, security mask, force security mode
and these for directories:
force directory mode, directory mask, directory security mask, force directory security mode,
Oh, and don't forget:
map hidden, map archive, map system
There may be more that I've forgotten, but these are the most common. See the manpage for smb.conf for details of how all these settings work.
You can use the "unix extensions" setting to disable all connections, whether made using cifs:// or smb:// URLS, to behave as the more basic smb:// connections usually do. The advantages of using the UNIX extensions are include that things like links (symbolic or hard) may work. Unfortunately this is a global setting, and can't be set per-share (at least with the Samba version I have here).
The "create mask" simply means that samba users are allowed to modify those permissions up to the mask, meaning if you set it to 777, then the user can modify all bits. This is not the same as unix file masks. Your setting is 0775, meaning that users can modify the permissions on User (rwx), Group (rwx) and Other (rw). This doesn't mean that the files will be created with those permissions, just that the user can use those permissions. To force a set of permissions, use something like:
What permissions were you trying to achieve btw?
After a while I figure it out setting this global variable: unix extensions = off
http://discussions.apple.com/thread.jspa?messageID=7349655