Reading the access attributes of directories in Windows

vsoler vicente.soler at gmail.com
Thu Aug 19 23:17:03 CEST 2010


On Aug 19, 10:59 pm, Tim Golden <m... at timgolden.me.uk> wrote:
> On 19/08/2010 9:17 PM, vsoler wrote:
>
>
>
> > 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
>
> I have a subversion branch for Python 3. If you have subversion
> access, try:
>
>    http://winsys.googlecode.com/svn/branches/py3k
>
> and do the python setup.py install dance.
>
> If you can't get that working, let me know and I'll publish
> an installer somewhere.
>
> TJG

I currently do not have subversion access in my PC. I could try to
install a free copy of it. But it you could ptovide an installer, it
certainly would do things easier. Please let me know if it is
possible.

Vicente Soler



More information about the Python-list mailing list