Jump to content


 


Register a free account to unlock additional features at BleepingComputer.com
Welcome to BleepingComputer, a free community where people like yourself come together to discuss and learn how to use their computers. Using the site is easy and fun. As a guest, you can browse and view the various discussions in the forums, but can not create a new topic or reply to an existing one unless you are logged in. Other benefits of registering an account are subscribing to topics and forums, creating a blog, and having no ads shown anywhere on the site.


Click here to Register a free account now! or read our Welcome Guide to learn how to use this site.

Photo

Server 2008: icacls to set permissions to multiple directories


  • Please log in to reply
4 replies to this topic

#1 m1ckrz

m1ckrz

  • Members
  • 39 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Los Angeles
  • Local time:04:31 AM

Posted 08 January 2014 - 02:25 PM

Hello,

 

     I was wondering if there was a way in icacls to set permissions for a single group but for multiple directories. I'm reconfiguring our fileshare server at work and it has become tedious having to reinput the same command over and over. I've tried using && but this doesn't really fix my issue because it is actually almost as tedious. 

 

     Any suggestions?


Edited by hamluis, 08 January 2014 - 04:22 PM.
Moved from Win 7 to Win NT - Hamluis.


BC AdBot (Login to Remove)

 


#2 x64

x64

  • Members
  • 352 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:London UK
  • Local time:12:31 PM

Posted 09 January 2014 - 02:01 AM

You've not given us much to work with but consider....

 

1) Combining the icals command with a "for /F" (which could read folder names from a list in a text file).See "for /?" for more info on that variant of "for". If you put this in a batch file don't forget the gotcha which requires the for variable to have double percentage signs when used INSIDE a batch file.

 

2) Restructure your folder structure to allow you to apply the permission in a smaller number of places, and to use inheritance to filter it to the other places where it is needed.

 

3) If you have a situation where a child folders of a parent folder need the permission, but the parent folder must not, consider the more exotic forms of inheritance (such as applies to 'subfolders only') maybe in conjunction with idea (2).

 

x64



#3 m1ckrz

m1ckrz
  • Topic Starter

  • Members
  • 39 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Los Angeles
  • Local time:04:31 AM

Posted 09 January 2014 - 08:44 PM

Sorry, here's a little more information on the subject:

 

     I have the folders structured based on department. Directors have modify rights to everything within the root department folders, thats no big deal. However, subordinates only have access to specific folders within the root. So Admins don't have acess to higher security folders. This becomes a hassle as I need to apply (RX,W) permissions for every specific folder.

     I suppose putting it all in a batch script would work fine, but that still doesn't provide me with a means of shortening the commands. Ideally, I need to be able to do the following (if possible):

 

     icacls "F:\SHARE\Purchasing\Requests" && "F:\SHARES\Purchasing\Finalized" && "F:\SHARES\Purchasing\Filled" /grant: r "PurchasingAdmin":(RX,W)

 

   What you said about using FOR sounds ideal. So if I wanted to assign RX,W permissions for a group to multiple folders, I could use FOR to run the icacls command on a list of them, correct? Can you give an example of how the syntax would work?



#4 x64

x64

  • Members
  • 352 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:London UK
  • Local time:12:31 PM

Posted 10 January 2014 - 02:02 AM

for /f %i in (folderlist.txt) do icacls %i (followed by rest of icacls command relating to setting permisions on a single path)

 

if used within a batch file that becomes for /f %%i in (folderlist.txt) do icacls %%i (etc...)



#5 m1ckrz

m1ckrz
  • Topic Starter

  • Members
  • 39 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Los Angeles
  • Local time:04:31 AM

Posted 06 February 2014 - 06:33 PM

for /f %i in (folderlist.txt) do icacls %i (followed by rest of icacls command relating to setting permisions on a single path)

 

if used within a batch file that becomes for /f %%i in (folderlist.txt) do icacls %%i (etc...)

 

Awesome, this worked great for saving file permissions in a batch file for easy implementation and quick deployment.






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users