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
Set permission failed on files generated with CopyFiles
7 posts
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...
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...
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.
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?)
(I don't see why, but the permission may not be inherited automatically to files if the ACL is changed afterwards?)
Originally posted by frodelanThe 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.
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.
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.
The problem is not "CopyFiles", the problem is most likely a file replacement function or macro which is creating a temp file in %TEMP% where the permissions inherited are different than those of the original file. This %TEMP% version of the file is likely copied over the previous file.