[python-win32] The "right" way to handle permission issues

Gremlin gremlin at armarize.com
Mon May 30 19:58:52 CEST 2011


Hello,

 

I'm having some trouble with Windows 7 and probably Windows Vista as well.
My application runs elevated and has to create files and folders within the
"Program Files"-Folder. (I can't store the files at another place.) I'm
using the os module (Python 2.7), rsync, 7zip and gzip to create those
files.

The trouble is the assignment of permissions to newly created files and
folders. I've already isolated the issue to rsync (I haven't tested 7zip and
gzip yet.), files and folders created with open() and os.mkdir are created
with the right permissions. (At least I suppose that because I'm able to
delete them without altering the security properties.)

 

When I look into the security properties of files created by rsync, there's
a group labelled with "None" and if I delete this group, I can delete the
file. But unfortunately this doesn't work with folders. The group will be
deleted, while Windows says the security properties couldn't be changed. (I
see.) However, I'm able to delete a folder if I remove all groups and add
myself again.

 

So my question is: How should I handle this issue within my application?

 

Of course, I know the function SetNamedSecurityInfo, but I don't know how to
use it "right". What kind of permission should I set? Can I fix this issue
with this function at all? How can I prevent further trouble for my users?

 

You see, I'm totally clueless so far. So if you can, please help me solving
this. :| 

 

Regards,

Johannes

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-win32/attachments/20110530/0ea1cbfe/attachment.html>


More information about the python-win32 mailing list