frodelan
16th November 2009 07:24 UTC
Set permission failed on files generated with CopyFiles
Hi, my installer includes some files I generate with CopyFiles during the installation process. I use AccessControl to give these files permissions. When I give permission on folder I do not get correct permission on the files I generated, but all others files in these folders get correct permission. I have to specify permission for each file I have generated to get correct permission.
Anyone who know why it is like that?
My code:
SetOutPath $EXEDIR\test
File /r C:\test\test.conf-dist
CopyFiles /SILENT "$EXEDIR\test\test.conf-dist" "$EXEDIR\test\test.conf"
; FAILED
AccessControl::GrantOnFile "$EXEDIR\test" "IUSR_TEST" "GenericRead + GenericExecute"
; OK
AccessControl::GrantOnFile "$EXEDIR\test\test.conf" "IUSR_TEST" "GenericRead + GenericExecute"
Best regards, Frode
MSG
16th November 2009 07:49 UTC
Well, if the file is copied (created) by an Administrator installer, the file's owner will be Administrator, not IUSR_TEST. Thus the file may not be accessible by IUSR_TEST. On the other hand, generic read + execute would normally be allowed to any user, except guests maybe... I think.
Another thing I can think of is $EXEDIR\test\test.conf-dist having inheriting disabled in its access settings. Though I'm not even sure if that is supposed to be maintained when a file is copied...
frodelan
16th November 2009 08:26 UTC
I do not understand why it should matter if the file is copied by an Administrator. I set the permissions on the created file in the installer, hence the file should get these permission and not the permission from the user who installed it.
Wizou
16th November 2009 08:53 UTC
You may try to change the permission before extracting file into the test folder, rather than after ?
(I don't see why, but the permission may not be inherited automatically to files if the ACL is changed afterwards?)
MSG
16th November 2009 09:46 UTC
Originally posted by frodelan
I do not understand why it should matter if the file is copied by an Administrator. I set the permissions on the created file in the installer, hence the file should get these permission and not the permission from the user who installed it.
The way I see it, you're setting permissions to the directory. Now I'm not an expert on ntfs permissions at all, but I could imagine an admin-owned file in a user-owned dir might do funky unexpected stuff. Then again it might not.
frodelan
17th November 2009 09:42 UTC
MSG: As I tried to explain in my original post every other files which is copied into that folder by the installer does get correct permission.