Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you set directory permissions in NSIS?

I'm trying to build a Windows installer using Nullsoft Install System that requires installation by an Administrator. The installer makes a "logs" directory. Since regular users can run this application, that directory needs to be writable by regular users. How do I specify that all users should have permission to have write access to that directory in the NSIS script language?

I admit that this sounds a like a sort of bad idea, but the application is just an internal app used by only a few people on a private network. I just need the log files saved so that I can see why the app is broken if something bad happens. The users can't be made administrator.

like image 989
Jay R. Avatar asked Sep 22 '08 19:09

Jay R.


People also ask

How do you write a NSIS script?

NSIS Setup You can use the NSIS Menu and under the Compiler section click Compile NSI scripts to start MakeNSISW. The makensisw.exe in the NSIS installation folder is the actual compiler. It has a graphical front end that explains three ways to load scripts, so it's very easy to use.


2 Answers

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.

like image 127
Jay R. Avatar answered Sep 22 '22 22:09

Jay R.


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.

like image 32
user474708 Avatar answered Sep 23 '22 22:09

user474708