[python-win32] Getting Remote Share User Group Names and Permissions
mail at timgolden.me.uk
Fri Feb 17 21:20:09 CET 2012
On 17/02/2012 18:26, Rod Person wrote:
> I'm trying to get a list of User Groups that have access to shares on a
> remote server. I am able to get a listing of all the shares on the
> server using wmi. This is the cloesest I got so far:
> 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.
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:
to see if it helps you out.
There's definitely more I can add (and I would almost certainly
be combining the wmi & winsys modules to do this) but I'd like
to hear back from you first before I start going off down the
wrong track in my attempts to help.
More information about the python-win32