Jump to content

Recommended Posts

Posted (edited)

I've got a special share that we use for our computer science students to compile executables on.

 

I can create a folder manually with the students username and apply permissions to it for that student only.

 

Is there any quicker way to do this? I really don't fancy doing 200 of these!

Edited by zag
Posted
you could set the home path to the new share using the %username% vairable at the end. it would then create the folders with correct permissions the same way the home directories are created then switch them back. I've used that method before with good results.
Posted

I know you can use the icacls command to set permissions via a command prompt so you must be able to script it by using a text file full of the usernames and then create a batch file to look up a name one at a time from the file, create a folder and then use the icacls command to apply the permissions.

 

No idea how I'm afraid but it might give some other person an idea how to do it.

  • Thanks 1
Posted
I do indeed. It's very old now, and the installer won't run on anything post XP. The actual program executable works fine on 2012 R2 though (it requires .NET 2.0, where the installer needs 1.1). It's a great piece of software - I use it every year to bulk fix the permissions for our new user folders.
Posted

Do you have the commands if it was one user?

 

If so get a list a of usernames and build a list of user specific commands in Excel using the concatenate function.

Posted (edited)
Do you have the commands if it was one user?

 

I do!

 

md "e:\users\students\user001"
icacls "e:\users\students\user001" /grant "user001":(OI)(CI)M

 

No idea how to get it to look up the username from an excel spreadsheet though.

Edited by Fazza
Posted
I do indeed. It's very old now, and the installer won't run on anything post XP. The actual program executable works fine on 2012 R2 though (it requires .NET 2.0, where the installer needs 1.1). It's a great piece of software - I use it every year to bulk fix the permissions for our new user folders.

 

Any guide on how it works, its slightly confusing!

Posted

Yup. Select Replace. Build the list of permissions (domain\%foldername%, domain\administrators, perhaps domain\teachers group) with the appropriate access for each. Then select the root folder you want to apply the permissions to and right-click/Exclude folders on the sub-folders you don't want to change.

 

domain\%foldername% is the important syntax.

  • Thanks 1
Posted (edited)

I'd do it in powershell like this;

 

$Users = Import-CSV -Path "\\Path\To\File.csv"

Foreach ($User in $Users) {
   $Username = $User.Name
   $DirectoryPath = "\\Path\to\directory\containing\$Username"
   $UserPerm = "ShortDomain\$Username"

   New-Item $DirectoryPath -type directory

   $acl = Get-Acl "$DirectoryPath"
   $permission = $UserPerm,"Modify","ContainerInherit,ObjectInherit","None","Allow"
   $accessRule = New-Object System.Security.AccessControl.FileSystemAccessRule $permission
   $acl.SetAccessRule($accessRule)
   $acl | Set-Acl "$DirectoryPath"
}

 

Using a CSV with a single column titled 'Name' with usernames in it.

Edited by Sephiroth
Posted

Thanks, I managed to get NTFSfix to work with basically 1 click!

 

All permissions set as expected. This saves me quite a bit of work!

 

Amazing :)

 

Here is the app extracted if anyone else needs it.

 

NTFSfix

  • Thanks 1
  • 2 weeks later...
Posted
Can't help but think...I wouldnt be allowing any folder on a school network for user created executables....how would you stop them putting any other executable there? Surely the solution to this is a virtual PC ...and one which does not have any access to the network.
Posted
Can't help but think...I wouldnt be allowing any folder on a school network for user created executables....how would you stop them putting any other executable there? Surely the solution to this is a virtual PC ...and one which does not have any access to the network.

 

We have FSRM setup to email me on every file executable saved there. Its a constant log which I check each week.

 

The students know this and get their account shut down right away if they save anything there. System works surprisingly well.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...