How do you set directory permissions in NSIS? How do you set directory permissions in NSIS? windows windows

How do you set directory permissions in NSIS?


Use the AccessControl plugin and then add this to the script, where the "logs" directory is in the install directory.

AccessControl::GrantOnFile "$INSTDIR\logs" "(BU)" "FullAccess"

That gives full access to the folder for all users.


AccessControl::GrantOnFile "<folder>" "(BU)" "FullAccess" didn't work for me on a Windows Server 2008 machine. Instead I had to use this one:

AccessControl::GrantOnFile "<folder>" "(S-1-5-32-545)" "FullAccess"

S-1-5-32-545 is equivalent to "Users" according to Microsoft Support: Well-known security identifiers in Windows operating systems.


Instead of changing the permissions on directories under Program Files, why not put the logs in a location that is writeable by all users.

See the 4.9.7.7 SetShellVarContext section in your NSIS documentation. You can use it with $APPDATA to get the application data folder that is writeable for all users.