Jump to content


This is a ready-only archive of the InstallSite Forum. You cannot post any new content here. / Dies ist ein Archiv des InstallSite Forums. Hier können keine neuen Beiträge veröffentlicht werden.
Photo

Set folder permissions


4 replies to this topic

shuttledude

shuttledude
  • Full Members
  • 26 posts

Posted 25 July 2006 - 13:27

I would like to know how to use InstallScript to set user access permissions to read and write for a particular subdirectory. Also, I need to know how to do this for a specified user object or even a group of users (for example, the ASPNET account user object, or "John Smith", or the "Lab Users" group). It is not acceptable for me to set read-write permissions for all users, I need to specify just for a specified user.

Glytzhkof

Glytzhkof
  • Moderators
  • 1,447 posts

Posted 25 July 2006 - 23:03

The best tool to do this is probably subinacl.exe from Microsoft. If you google it you should find the Microsoft MSDN page where you can download it and the associated documentation. It has very advanced features to do what you require. In typical Microsoft fashion: "everything is possible and nothing is easy".
Regards
-Stein Åsmul

shuttledude

shuttledude
  • Full Members
  • 26 posts

Posted 26 July 2006 - 16:48

Thanks, that's a nice utility and it seems to work. For example, to deny access to a directory named C:\Test for a user named TestUser you would say:
CODE

subinacl.exe /subdirec c:\Test /deny=TestUser


However, the license agreement for this utility indicates it cannot be redistributed at will. I suppose I could temporarily place it in a hidden directory, use it, then delete it, but the delete might fail, and anyway that violates the spirit of the agreement and the purpose of the tool. But thanks for the suggestion anyway; it'll probably come in handy for in-house use.


shuttledude

shuttledude
  • Full Members
  • 26 posts

Posted 29 August 2006 - 20:30

I found the answer, in case anyone needs to know this information. Microsoft's "cacls.exe" program, located in the windows\system32 subdirectory, can be used to assign directory permissions for specific individual user accounts.

I simply used a DOS batch file that invokes cacls.exe. Here is an example that gives the ASPNET account full access to C:\MyDir\SubDir

CODE

call cacls "C:\MyDir\SubDir" /t /e /g ASPNET:F


To get full instructions about how to use the cacls command, open a DOS prompt, navigate to the windows\system32 subdirectory, and type the following:

CODE

cacls /?


Glytzhkof

Glytzhkof
  • Moderators
  • 1,447 posts

Posted 29 August 2006 - 20:39

Be careful changing permissions and in particular changing owner, it may affect uninstall / install of upgrades. Be sure to test this before going live.
Regards
-Stein Åsmul