OSX 10.9.2 vs Samba 4.x battle of the permissions

Did a fresh install of Ubuntu Trusty (14.04) and was excited to play with samba 4 (samba-4.1.6-Ubuntu).

As a small workgroup/stand alone samba server I wanted new files to be 0664 and new directories to be 2775. That’s how the old server was configured and OS X Mavericks played great with samba-3.x

Things worked as expected until I tried making new files from OS X Mavericks. No matter what I used for “create mask” and “force create mode”, the new files always ended up being 0644 and no matter what I used for “directory mask” and “force directory mode” directories ended up 0755.

Lots of Googling put me on false paths and dead ends. Finally putting a bunch of different posts together I came up with this.

This gives me the desired permissions on new files and directories. Just sharing with everyone else.