Nitin Garg
2013-Jul-29 08:12 UTC
[Samba] Check user's access rights / permissions in CIFS folders (from Linux)
I'm connecting to a Windows CIFS share from a Linux machine using libsmbclient. Is there a way for me to know if the user has write permissions to a particular file/folder? I know that smbcacls can be used to get the ACLs, something like the following: REVISION:1, OWNER:S-1-5-21-1021440835-268907629-4167533493-1165, GROUP:S-1-5-21-1021440835-268907629-4167533493-513, ACL:S-1-1-0:0/16/0x001200a9, ACL:S-1-5-18:0/16/0x001f01ff, ACL:S-1-5-32-544:0/16/0x001f01ff, ACL:S-1-5-21-1021440835-268907629-4167533493-500:0/16/0x001f01ff, smbc_getxattr() in libsmbclient.h also returns these attributes. But how do I use this information to calculate the effective rights of the current user? I think I could do it if I get the SID of the current user and the groups that this user is a member of. But I'm not sure how to do that from a Linux box. Samba version: 3.2.15 Regards,Nitin