Changing the permissions on a file for a user
Although setting access at the folder level is good for quickly securing all of your files in one fell swoop, we can still fine-tune permissions on a file-by-file basis. This might be useful, for example, if you have a main executable that can be run by anyone but another administrative utility that should only be run by certain users.
In this recipe, we'll install a text file and update its permissions so that our user Joe has full access.
Getting ready
To prepare for this recipe, perform the following steps:
- Create a new setup project and name it
FilePermissionsInstaller
. - Add a text file named
Sample.txt
to the project and then add aComponent
element to include it in the installation:<ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER"> <Component Id="cmpSampleTXT" Guid="{FB746118-B1E5-42DC-AA76-862C4E1EABCF}"> <File Source="Sample.txt...