简体   繁体   中英

MSI Installer file/folder permissions

I'm trying to install a set of files within the programdata folder using basic MSI installer. As the content of the files are dynamic and generated during the installation process, I'm creating the files in C# code during installation.

The files are created in the appropriate folders, and everything is good, except the files permissions. As I understand, files are supposed to inherit their permissions from the parent folder (if enabled), but in this case, this does not happen. The files I create should be writable for regular users, and i do not wan't to set permissions explicitly for each file created. Could the problem be that the installer runs with different permissions, and therefore the files does not inherit the permissions from their parent folders?

Thanks in advance for any help.

the installer runs with administrator access, which would allow it to change anything in program files. A normal user would have read only access to the program files folder and the ProgramData/Common Application Data folder.

MSI's lock permission table allows a setup program to change a folder's permission after creating in ProgramData/Common Application Data. Visual Studio's setup projects does not support MSI's lock permission table, so if you need the folder you created to be writable to normal users in a setup project you need to grant the right in a custom action using SetNamedSecurityInfo or modify the MSI database as a post build step. You can also find a MSI authoring software that can deal with MSI's lock permission table.

我有类似的问题,我可以使用这里的例子来解决它。

I've had a similar problem here. The problem here is that msi was creating the files with user SYSTEM. And the application during runtime was using the logged user (that didn't have write permission to this file). What I did is create a new file (if not exists) during application initialization with the one created by the installer. Then this file will have the write permission. It's not a good practice but solved my problem.

如果使用自定义操作手动设置文件夹权限,并使用另一个自定义操作生成并安装文件,则问题可能是由执行顺序引起的。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM