Reading the access attributes of directories in Windows

vsoler vicente.soler at gmail.com
Thu Aug 19 16:17:40 EDT 2010


On Aug 19, 8:55 pm, Tim Golden <m... at timgolden.me.uk> wrote:
> On 19/08/2010 4:55 PM, vsoler wrote:
>
> > I need to read, for each of the directories in a shared file server
> > unit, who has access to the directories and what type of access
> > privileges.
>
> > This is something that I can easily do interactively in my Windows
> > Document Explorer by right clicking a single directory, clicking on
> > Properties, then on Security.
>
> > There I can see the Users and Group of Users that have access to the
> > selected directory, as well as the type of access to that directory
> > (Read/Write/eXecute etc.)
>
> Here you have one of those occasions when the Windows GUI does
> a very good job of presenting a simplified but perfectly usable
> interface layer on top of a moderately complex security scheme.
>
> It's not as easy as you think.
>
> > I've been looking in the "os" library, and found the "os.chmod" method
> > but I am not sure that it is going to give me what I need. Should I
> > also used library "stat"?
>
> No. Both of these are basically doing a best-endeavours job of mapping
> certain Windows attributes to some Posix equivalent. They're essentially
> useless for anything beyond the most trivial tasks.
>
> Have a read here which will at least put you on the path of knowing
> what terminology you need to search for:
>
>    http://timgolden.me.uk/python/win32_how_do_i/add-security-to-a-file.html
>    http://timgolden.me.uk/python/win32_how_do_i/get-the-owner-of-a-file....
>
> and if you're interested, this is the kind of thing my winsys
> package is reasonably good at:
>
>    http://timgolden.me.uk/python/winsys/security.html#module-security
>
> TJG

Thank you very much, Tim, for your answer.

It looks as though it is going to suit my needs.

Your file WinSys-0.4.win32-py2.5.msi is obviously for python 2.5 and
2.6.
File WinSys-0.4.zip should be for the same versions of Python,
probably.
What about your WinSys-0.5beta.win32.exe file? is it for python 3?

I currently have python 3 in my pc. Do I need to install a previous
version of python?

Thank you for your help

Vicente Soler



More information about the Python-list mailing list