File permissions issue on OS X El Capitan and SMB share

Solution 1:

This work for me

[Shared]
    comment = Folder Shared
    path = /path
    unix extensions = no
    force group = root
    force user = root
    browsable = yes
    writeable = yes
    create mask = 0644
    directory mask = 0755
    force create mode = 0644
    force directory mode = 0755
    hide dot files = no
    guest ok = no
    public = no
    valid users = @users

Solution 2:

You can also try using a recent (4.2 or later) version of Samba that supports SMB2 and enabling vfs_fruit on the share. This will add support to Apple's AAPL extension for SMB2 which should work better that the Unix extensions for SMB1/CIFS.

Solution 3:

This issue still persists after upgrading to OS X 10.11.1.

As a partial workaround, you can share the files using SSHFS instead of SMB. SSHFS preserves the permissions, however it have several drawbacks:

  • Issues when multiple users write the same files.
  • No support for native extended attributes, ACLs etc.
  • Slower than SMB.

See also discussion on Apple Support Communities: https://discussions.apple.com/message/29104711

Solution 4:

TL;DR version:

mount_smbfs -f 0644 -d 0755 //<user@host/share> <share>

Long version:

I know this thread is old, but this is still a relevant problem. In my case, I'm using git over CIFS to work with a remote working tree on a virtual Linux instance. The git repository actually exists on my host system but I have the checkout on the remote system. This is so I can develop my Linux specific application on macOS using a VM but keep the git repository in the host.

Anyway, I was experiencing the same issue as the OP. Git detected changes in the file mode, wanting to commit the files with execute bits since the share driver created regular files with execute permissions by default. To work around this, I figured out how to mount the share manually using the mount_smbfs command. The key options are -f and -d for file mode and directory mode respectively.

For the record, I'm using macOS 10.11.6 "El capitan".