[python-win32] Getting Remote Share User Group Names and Permissions

Rod Person rodperson at rodperson.com
Sun Feb 19 00:22:29 CET 2012


On Fri, 17 Feb 2012 20:20:09 +0000
Tim Golden <mail at timgolden.me.uk> wrote:
> On 17/02/2012 18:26, Rod Person wrote:
> >
> > import win32security as win32s
> >
> > sd =
> > win32s.GetFileSecurity(sh,win32security.GROUP_SECURITY_INFORMATION)
> 
> Assuming that "sh" here is the name of of the share
> (eg \\server\share1) then be aware that the result
> of GetFileSecurity is the security on the underlying
> folder, not the security of the share itself.

Thanks for the reply, Tim. Would have replied earlier but somehow this
ended up as spam.

You are correct here, sh is the share. I making a leap - for our
organization - that the share and folder have the same permissions.
There have been cases where the permission were different. Some of
these shares have existed since NT 3.1 and just migrated with permission
since that time.

> Now, share-level security is, I think, relatively unusual
> and you might well want to know the file security as well,
> but they're not the same thing. (Just in case).
> 
> Another caveat: you almost certainly don't want the group security
> from that share, either. That's a pretty much defunct relic of
> the Windows Posix layer which would mimic the Unix security
> model by giving every file a group and an owner. The owner
> is still used sometimes. The group, probably never.
> 
> Have a look at this:
> 
> http://timgolden.me.uk/python/win32_how_do_i/add-security-to-a-file.html

This what I used to get as far as I have :)

But, I think the mistake I making is using the share as you point out.
I should be using the actual folder name, in which case I'd need to 
be making a connection to the serve with wmi. Is that what your saying
to me?


-- 
Rod Person         http://www.rodperson.com     rodperson at rodperson.com
  
"Let us in the name of the Holy Trinity, go on sending all the slaves 
 that can be sold." 
- Letter from Christopher Columbus.
  J.A. Rawley, The Trans-Atlantic Slave Trade: A History. Pg.3


More information about the python-win32 mailing list