On 31/05/2011 3:58 AM, Gremlin wrote:
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. :|
In general, you should look for a way to stop the app from screwing with
the permissions in the first place. tar has a similar problem which can
be overridden with something like --no-same-permissions.
According to
http://superuser.com/questions/69620/rsync-file-permissions-on-windows,
rsync has a --chmod option that might work.
HTH,
Mark
_______________________________________________
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32