Setting Permissions on Multiple Folders (2000)
Results 1 to 6 of 6

Thread: Setting Permissions on Multiple Folders (2000)

  1. #1
    Join Date
    Apr 2006
    Posts
    5

    Setting Permissions on Multiple Folders (2000)

    I am currenlty setting up the classes in our school and have copied the students data files from an old server to our new W2k3 server.

    The students have a mandatory profile with three icons on their desktop (ie, my computer, recycle bin). In my computer they need to see a "Public" folder and their "Home Directory" only and thats it.

    The above is not part of the issue just clarification for you about what is needed from my perspective.

    I am going to use Access Based Enumeration to provide the security so that it only shows the folders to which they have permissions

    ie their home directory will be something like this

    \\server\share (the share being their year group)

    ABE will be set on the year group folder under which are individual folders for each student. By giving each student permissions to access their own folders when they open my computer and click on the mapped year group they will only see their folder and no-one elses.

    Now to the crunch. I want to be able to set the permissions for these folders on the fly, ie I don't want to have to go into each folder and set the permissions for each one. The permissions that students get for their own folder is the same (modify). Is there a way to do this? I noticed that in an old archived discussion somebody mentioned a script but the archive discussion will not load.

    http://discussions.virtualdr.com/For...ML/009712.html

    Chris

  2. #2
    Join Date
    Feb 2001
    Location
    Adelaide, South Australia
    Posts
    6,447
    I think the tool you're after is xcacls.exe or xcacls.vbs.
    Safe computing is a habit, not a toolkit.

  3. #3
    Join Date
    Apr 2006
    Posts
    5
    xcacls works fine if you are wanting to change the permissions of multiple foldes with one username. However I am looking at home directories of students so I need to not only assign each student to their individual folder I also need to assign their permissions. By using xcacls it will take even longer than using the right click, properties, security, add, user, set permissions actions that i have to take.

  4. #4
    Join Date
    Feb 2001
    Location
    Adelaide, South Australia
    Posts
    6,447
    Even if you script it? I'm assuming the directory names match the usernames, and that you probably have a list of usernames as a spreadsheet or text file or something. I was envisaging a handful of commands like this, one for each year:
    Code:
    for /f %u in (2006.txt) do xcacls.exe D:\StudentData\2006\%u {perms}
    Safe computing is a habit, not a toolkit.

  5. #5
    Join Date
    Apr 2006
    Posts
    5
    That sounds pretty feasible. Could you break down the code for me so that I understand where I am going with the the script.

    The students are broken down as follows

    1999 = Year 13
    2000 = Year 12
    2001 = Year 11
    2002 = Year 10
    2003 = Year 9
    2004 = Year 8
    2005 = Year 7

    Each of these folders is shared and ABE is inforce. Inside each of these folders is an individual folder for each student that is assigned their username as the name of the folder. I want to be able to assign each user to their individual folder based upon their username and to give them modify permissions to their folder. With ABE in force the will only then see their own folder inside their year folder. The year folder is shared, mapped and is set as their home folder.

    I hope this makes it clear. By the time I do this I may as well have done it the long way anyway he he. Useful to know though

    Thanks for your time by the way Tuttle

  6. #6
    Join Date
    Feb 2001
    Location
    Adelaide, South Australia
    Posts
    6,447
    Automating something like this the first time is always less efficient than doing it by hand. The payoff is next year, when you can just pull out the old script.

    As for that snippet I posted:
    • for, in, do -- for is a built-in command (at a command prompt) which loops. in and do just have to be there.
    • /f -- this tells it that the stuff in the brackets is a text file, not just the list you want to loop through
    • %u -- in the command at the end, %u will be replaced by the current loop item. The u isn't magic, any single letter works.
    • (2006.txt) -- this is the name of the file you want it to loop through. Without the /f, you'd do "(user1,user2,user3)" instead.
    • xcacls.exe D:\StudentData\2006\%u {perms} -- I've never used xcacls myself, hence the fill-in-the-gap at the end. But for each line in your text file, it'll run this command with %u replaced by the student name.

    The text file is just one value per line, like this:
    Code:
    User1
    User2
    User3
    A good way to experiment with this is to use echo, ie:
    Code:
    for /f %u in (2006.txt) do echo xcacls.exe D:\StudentData\2006\%u {perms}
    That will print out the commands it would run, insetead of actually doing it. If you have spaces in the username, for example, you can see that it looks wrong and you need quotes around "D:\StudentData\2006\%u". Once you're happy with how it looks, you can try it with a few test directories, then do it for real.
    Safe computing is a habit, not a toolkit.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •