Archive: Setting Folder Permissions


Setting Folder Permissions
Hi I am trying to set the permissions on my root folder to be normal other than read only does anyone know how to do this. I have tried using setfileattributes I have also seen other people have had to try and do this can anyone advise me can this be done ie set the attributes of a folder.


Hi f1nn!

Have a look:

http://nsis.sourceforge.net/AccessControl_plug-in

Cheers

Bruno


Hi Bholliger,

I cam across the access control plug in and tryed it I believe that I am using it in the proper way. I installed the plug in to the NSIS plug in folder. Then I added a section to the script and in the section used the following from the web site example
AccessControl::GrantOnFile \
"$INSTDIR" "(BU)" "GenericRead + GenericWrite"

The problem now is that when i first installl the application as admin. and then check the permissions onthe folder under users ie. Right click on the start menu click on explorer navigate to the app folder in c program files right click here on properties then security tab and highlight users users do not have the Write permission. However If I run the installer a second time without uninstalling and recheck the permission the users now have Write permissions. I am at a loss here to understand why this is requires two runs of the installer to set the write permissions on the users. I would be glad of any suggestions or help with what is the cause of this.

Many Thanks


You probably created the folder after you gave it permissions. Move the AccessControl call below the code where you create the folder.

BTW, giving all users permissions for the Program Files folder or anything under it is a bad idea. You are allowing users to interfere with what other users do. Not only you are giving users to change program settings for each other, you also give them permissions to change the program itself. This is a security hole at worst and an annoyance for users at best. You should save your program settings in the application data folder instead.


Hi Kichik,

Thhanks for the reply I agree with what you are saying this is just a quick fix for now to let try to sort out what is happening with another problem I am having with all user install on XP as I have been getting some strange results. On XP Home edition the desktop icons show up on any users drive and some XP PRO machines on others the icons dont show up. This may be related to the way a new user is added I think but i am not sure and I think it may be related to the problem at this thread.

http://forums.winamp.com/showthread....hreadid=248693

So what I am trying to do is get it running on others users accounts to gather some info on the behaviour. I will try what you suggest and let you know

Many thanks


Hi Kichik,

Thank you for the suggestion it solved my problem I was setting the permission to early in the script, I now do it after the mainsection were the files are added and it works fine, the folder now has write permission.

Many thanks