I don't want to hijack this thread, but it seems to be so close to the problem I'm having, it seems appropriate. Please tell me if I should open a new thread or not.
We have a FreeNAS 9.2.1.5-RELASE instance with several CIFS shares. Accessing and using these shares from Windows 7 clients works just fine, until we throw some CentOS boxes into the mix.
I have a CentOS 6.5 client running mount.cifs 6.4 (upgraded manually, comes with 4.8.1). It's a minimal install (it's actually a server template for us).
My mount command:
mount -t cifs //server/share /mnt/share/ -o username=my_username,uid=root,gid=root,domain=my_domain,sec=ntlmv2,cifsacl
First I just create a file and get the permissions:
[root@localhost share]# touch file1
[root@localhost share]# getcifsacl file1
REVISION:0x1
CONTROL:0x8004
OWNER:S-1-5-21-[my_domain_id]-3360
GROUP:S-1-5-21-[my_domain_id]-513
ACL:S-1-5-21-[my_domain_id]-3360:ALLOWED/0x0/FULL
ACL:S-1-5-21-[my_domain_id]-513:ALLOWED/0x0/FULL
Looks good!
Then I edit the file and get permissions again:
[root@localhost share]# vi file1 (added a couple of words then saved)
[root@localhost share]# getcifsacl file1
REVISION:0x1
CONTROL:0x8004
OWNER:S-1-5-21-[my_domain_id]-3360
GROUP:S-1-5-21-[my_domain_id]-513
ACL:S-1-5-21-[my_domain_id]-3360:DENIED/0x0/0x27
ACL:S-1-5-21-[my_domain_id]-3360:ALLOWED/0x0/FULL
ACL:S-1-5-21-[my_domain_id]-3360:ALLOWED/0x0/0x1e0198
ACL:S-1-5-21-[my_domain_id]-513:ALLOWED/0x0/0x1200af
ACL:S-1-1-0:ALLOWED/0x0/0x120088
What happened?! This also happens if I use vi to create the file (permissions are good on first save) and then edit (permissions are wrong).
Windows permissions also accurate reflect these permissions.
If I create files in Windows, the permissions are assigned as expected upon file creation and are not changed after files are edited and saved.
So, why are the permissions changing on the second write of a file?
I've tried using or not using uid, gid, noperm, cifsacl, though I haven't done every possible permutation.
Any thoughts of things to try?