windowspermissionsinstallationinno-setupacl

How to give one specific user rights to a folder in Inno Setup


I want to give folder rights to one specific user (not user groups). I have seen multiple examples but it give rights to whole user group.

[Dirs]
Name: "{app}"; Permissions: users-full

http://www.jrsoftware.org/ishelp/index.php?topic=dirssection

I tried this, but I received an error

[Dirs]
Name: "{app}"; Permissions: John-full

Error on line 68 in D:\installer.iss: Parameter "Permissions" includes an unknown SID: "John"

Is it possible to give rights to one specific user (hard code string)?


Solution

  • I must say that I find this quite suspicious. Users should not have write permissions to application installation folder. If the application needs to store some data, it should write them to a user profile folder (C:\Users\username\AppData) or to a common data folder (C:\ProgramData).
    See also Application does not work when installed with Inno Setup.


    Anyway, Inno Setup does not support granting permissions to a user. I actually assume, it's because there's no real good use case for that (as explained above).

    But you can use Windows icacls or cacls commands from [Run] section instead.

    [Run]
    Filename: "icacls"; Parameters: """{app}"" /grant John:w"; Flags: runhidden
    
    [Run]
    Filename: "cacls"; Parameters: """{app}"" /e /g John:w"; Flags: runhidden