Jump to content

Script Needed to Change Ownership on User Home Directories


Recommended Posts

Posted

To prepare for implementing disk quotas on an R2 file server with 300 user

home directories--most of which are currently owned by domain administrators,

I am seeking a script which will change ownership on each of the user home

directories (named as username) and all contents within each home directory

back to each individual user . This is because of my understanding that disk

quotas are based upon file ownership. I understand that subinacl is the tool

to use, but I am not certain about the syntax. Ideally the script would

iteratively read each directory, determine the username from the directory

name and then apply the ownership without otherwise changing any other ACLs.

Help anyone?

  • Replies 7
  • Created
  • Last Reply
Guest Pegasus \(MVP\)
Posted

Re: Script Needed to Change Ownership on User Home Directories

 

 

"Scott" <Scott@discussions.microsoft.com> wrote in message

news:7FC4BC58-3F9C-41B9-AF4E-8D13BAA360C2@microsoft.com...

> To prepare for implementing disk quotas on an R2 file server with 300 user

> home directories--most of which are currently owned by domain

> administrators,

> I am seeking a script which will change ownership on each of the user home

> directories (named as username) and all contents within each home

> directory

> back to each individual user . This is because of my understanding that

> disk

> quotas are based upon file ownership. I understand that subinacl is the

> tool

> to use, but I am not certain about the syntax. Ideally the script would

> iteratively read each directory, determine the username from the directory

> name and then apply the ownership without otherwise changing any other

> ACLs.

> Help anyone?

 

fileacl.exe

(http://www.microsoft.com/downloads/details.aspx?FamilyID=723f64ea-34f0-4e6d-9a72-004d35de4e64&displaylang=en)

might be a little easier to use than subinacl.exe. Run some tests with it

to build up your confidence before you apply it to the real thing.

Posted

Re: Script Needed to Change Ownership on User Home Directories

 

Thanks for the response. I have tested the use of subinacl in this format:

 

subinacl /subdirectories D:\Users\<username>\*.* /setowner=domain\<username>

 

That successfully changes the ownership on all directories and files below

the d:\users\username but doesn't modify the top level directory itself.

Then I ran this command (removing the *.*):

 

subinacl /subdirectories D:\Faculty\Users\<username>

/setowner=glastonburyus\<username>

 

It modified the top level directory but then the script just hangs at the

command prompt with blinking cursor without completing.

What am I doing wrong?

 

"Pegasus (MVP)" wrote:

>

> "Scott" <Scott@discussions.microsoft.com> wrote in message

> news:7FC4BC58-3F9C-41B9-AF4E-8D13BAA360C2@microsoft.com...

> > To prepare for implementing disk quotas on an R2 file server with 300 user

> > home directories--most of which are currently owned by domain

> > administrators,

> > I am seeking a script which will change ownership on each of the user home

> > directories (named as username) and all contents within each home

> > directory

> > back to each individual user . This is because of my understanding that

> > disk

> > quotas are based upon file ownership. I understand that subinacl is the

> > tool

> > to use, but I am not certain about the syntax. Ideally the script would

> > iteratively read each directory, determine the username from the directory

> > name and then apply the ownership without otherwise changing any other

> > ACLs.

> > Help anyone?

>

> fileacl.exe

> (http://www.microsoft.com/downloads/details.aspx?FamilyID=723f64ea-34f0-4e6d-9a72-004d35de4e64&displaylang=en)

> might be a little easier to use than subinacl.exe. Run some tests with it

> to build up your confidence before you apply it to the real thing.

>

>

>

Guest Pegasus \(MVP\)
Posted

Re: Script Needed to Change Ownership on User Home Directories

 

 

"Scott" <Scott@discussions.microsoft.com> wrote in message

news:FEB75E48-B58A-4BA2-92AF-C2EB8386AD68@microsoft.com...

> Thanks for the response. I have tested the use of subinacl in this format:

>

> subinacl /subdirectories D:\Users\<username>\*.*

> /setowner=domain\<username>

>

> That successfully changes the ownership on all directories and files below

> the d:\users\username but doesn't modify the top level directory itself.

> Then I ran this command (removing the *.*):

>

> subinacl /subdirectories D:\Faculty\Users\<username>

> /setowner=glastonburyus\<username>

>

> It modified the top level directory but then the script just hangs at the

> command prompt with blinking cursor without completing.

> What am I doing wrong?

>

 

You're not listening, that's all! If you were listening then you'd

notice that your command does not "hang" - it wades through

all Faculty folders, causing a lot of disk grinding. Eventually it

will finish its job.

 

Try this command instead: subinacl /file c:\Test /setowner=config

Posted

Re: Script Needed to Change Ownership on User Home Directories

 

Thank you for responding.

 

You would not have had a way of knowing this, but the test was performed on

a very small subset of 4 folders and a total of 6 files. There was nothing to

grind through. ...not that I'm any 'golden ear'

 

When I ran the command you suggested, this was what was returned:

 

C:\WINNT\system32>subinacl /file c:\test /setowner=config

LookupAccountName : setowner c:\test : config : 1337 The security ID

structure is invalid.

 

Current object c:\test will not be processed

 

 

Elapsed Time: 00 00:00:00

Done: 0, Modified 0, Failed 0, Syntax errors 1

Last Syntax Error:WARNING : /setowner=config : Error when checking arguments

- c:\test

 

"Pegasus (MVP)" wrote:

>

> "Scott" <Scott@discussions.microsoft.com> wrote in message

> news:FEB75E48-B58A-4BA2-92AF-C2EB8386AD68@microsoft.com...

> > Thanks for the response. I have tested the use of subinacl in this format:

> >

> > subinacl /subdirectories D:\Users\<username>\*.*

> > /setowner=domain\<username>

> >

> > That successfully changes the ownership on all directories and files below

> > the d:\users\username but doesn't modify the top level directory itself.

> > Then I ran this command (removing the *.*):

> >

> > subinacl /subdirectories D:\Faculty\Users\<username>

> > /setowner=glastonburyus\<username>

> >

> > It modified the top level directory but then the script just hangs at the

> > command prompt with blinking cursor without completing.

> > What am I doing wrong?

> >

>

> You're not listening, that's all! If you were listening then you'd

> notice that your command does not "hang" - it wades through

> all Faculty folders, causing a lot of disk grinding. Eventually it

> will finish its job.

>

> Try this command instead: subinacl /file c:\Test /setowner=config

>

>

>

Guest Pegasus \(MVP\)
Posted

Re: Script Needed to Change Ownership on User Home Directories

 

It's hardly surprising that my command failed on your machine.

"C:\Test" is a folder on my own PC and "Config" is an account

on my own machine. Your machine would be totally different!

 

 

"Scott" <Scott@discussions.microsoft.com> wrote in message

news:18B0561A-39DB-4DE4-A023-B87D55A54C65@microsoft.com...

> Thank you for responding.

>

> You would not have had a way of knowing this, but the test was performed

> on

> a very small subset of 4 folders and a total of 6 files. There was nothing

> to

> grind through. ...not that I'm any 'golden ear'

>

> When I ran the command you suggested, this was what was returned:

>

> C:\WINNT\system32>subinacl /file c:\test /setowner=config

> LookupAccountName : setowner c:\test : config : 1337 The security ID

> structure is invalid.

>

> Current object c:\test will not be processed

>

>

> Elapsed Time: 00 00:00:00

> Done: 0, Modified 0, Failed 0, Syntax errors 1

> Last Syntax Error:WARNING : /setowner=config : Error when checking

> arguments

> - c:\test

>

> "Pegasus (MVP)" wrote:

>

>>

>> "Scott" <Scott@discussions.microsoft.com> wrote in message

>> news:FEB75E48-B58A-4BA2-92AF-C2EB8386AD68@microsoft.com...

>> > Thanks for the response. I have tested the use of subinacl in this

>> > format:

>> >

>> > subinacl /subdirectories D:\Users\<username>\*.*

>> > /setowner=domain\<username>

>> >

>> > That successfully changes the ownership on all directories and files

>> > below

>> > the d:\users\username but doesn't modify the top level directory

>> > itself.

>> > Then I ran this command (removing the *.*):

>> >

>> > subinacl /subdirectories D:\Faculty\Users\<username>

>> > /setowner=glastonburyus\<username>

>> >

>> > It modified the top level directory but then the script just hangs at

>> > the

>> > command prompt with blinking cursor without completing.

>> > What am I doing wrong?

>> >

>>

>> You're not listening, that's all! If you were listening then you'd

>> notice that your command does not "hang" - it wades through

>> all Faculty folders, causing a lot of disk grinding. Eventually it

>> will finish its job.

>>

>> Try this command instead: subinacl /file c:\Test /setowner=config

>>

>>

>>

Posted

Re: Script Needed to Change Ownership on User Home Directories

 

I used C:\Test in this msg thread as a 'proxy' for the actual path on our

server which, of course, was different. I ran the command against the actual

server path in which I had created enough test files and folders to be

sufficient for testing purposes.

 

"Pegasus (MVP)" wrote:

> It's hardly surprising that my command failed on your machine.

> "C:\Test" is a folder on my own PC and "Config" is an account

> on my own machine. Your machine would be totally different!

>

>

> "Scott" <Scott@discussions.microsoft.com> wrote in message

> news:18B0561A-39DB-4DE4-A023-B87D55A54C65@microsoft.com...

> > Thank you for responding.

> >

> > You would not have had a way of knowing this, but the test was performed

> > on

> > a very small subset of 4 folders and a total of 6 files. There was nothing

> > to

> > grind through. ...not that I'm any 'golden ear'

> >

> > When I ran the command you suggested, this was what was returned:

> >

> > C:\WINNT\system32>subinacl /file c:\test /setowner=config

> > LookupAccountName : setowner c:\test : config : 1337 The security ID

> > structure is invalid.

> >

> > Current object c:\test will not be processed

> >

> >

> > Elapsed Time: 00 00:00:00

> > Done: 0, Modified 0, Failed 0, Syntax errors 1

> > Last Syntax Error:WARNING : /setowner=config : Error when checking

> > arguments

> > - c:\test

> >

> > "Pegasus (MVP)" wrote:

> >

> >>

> >> "Scott" <Scott@discussions.microsoft.com> wrote in message

> >> news:FEB75E48-B58A-4BA2-92AF-C2EB8386AD68@microsoft.com...

> >> > Thanks for the response. I have tested the use of subinacl in this

> >> > format:

> >> >

> >> > subinacl /subdirectories D:\Users\<username>\*.*

> >> > /setowner=domain\<username>

> >> >

> >> > That successfully changes the ownership on all directories and files

> >> > below

> >> > the d:\users\username but doesn't modify the top level directory

> >> > itself.

> >> > Then I ran this command (removing the *.*):

> >> >

> >> > subinacl /subdirectories D:\Faculty\Users\<username>

> >> > /setowner=glastonburyus\<username>

> >> >

> >> > It modified the top level directory but then the script just hangs at

> >> > the

> >> > command prompt with blinking cursor without completing.

> >> > What am I doing wrong?

> >> >

> >>

> >> You're not listening, that's all! If you were listening then you'd

> >> notice that your command does not "hang" - it wades through

> >> all Faculty folders, causing a lot of disk grinding. Eventually it

> >> will finish its job.

> >>

> >> Try this command instead: subinacl /file c:\Test /setowner=config

> >>

> >>

> >>

>

>

>

Guest Pegasus \(MVP\)
Posted

Re: Script Needed to Change Ownership on User Home Directories

 

I assure you that the command works when used with actual

path and account names. Try it on some other machines and

folders to build up your confidence.

 

 

"Scott" <Scott@discussions.microsoft.com> wrote in message

news:C5E858BA-185F-4072-8033-526545A6E2A7@microsoft.com...

>I used C:\Test in this msg thread as a 'proxy' for the actual path on our

> server which, of course, was different. I ran the command against the

> actual

> server path in which I had created enough test files and folders to be

> sufficient for testing purposes.

>

> "Pegasus (MVP)" wrote:

>

>> It's hardly surprising that my command failed on your machine.

>> "C:\Test" is a folder on my own PC and "Config" is an account

>> on my own machine. Your machine would be totally different!

>>

>>

>> "Scott" <Scott@discussions.microsoft.com> wrote in message

>> news:18B0561A-39DB-4DE4-A023-B87D55A54C65@microsoft.com...

>> > Thank you for responding.

>> >

>> > You would not have had a way of knowing this, but the test was

>> > performed

>> > on

>> > a very small subset of 4 folders and a total of 6 files. There was

>> > nothing

>> > to

>> > grind through. ...not that I'm any 'golden ear'

>> >

>> > When I ran the command you suggested, this was what was returned:

>> >

>> > C:\WINNT\system32>subinacl /file c:\test /setowner=config

>> > LookupAccountName : setowner c:\test : config : 1337 The security ID

>> > structure is invalid.

>> >

>> > Current object c:\test will not be processed

>> >

>> >

>> > Elapsed Time: 00 00:00:00

>> > Done: 0, Modified 0, Failed 0, Syntax errors

>> > 1

>> > Last Syntax Error:WARNING : /setowner=config : Error when checking

>> > arguments

>> > - c:\test

>> >

>> > "Pegasus (MVP)" wrote:

>> >

>> >>

>> >> "Scott" <Scott@discussions.microsoft.com> wrote in message

>> >> news:FEB75E48-B58A-4BA2-92AF-C2EB8386AD68@microsoft.com...

>> >> > Thanks for the response. I have tested the use of subinacl in this

>> >> > format:

>> >> >

>> >> > subinacl /subdirectories D:\Users\<username>\*.*

>> >> > /setowner=domain\<username>

>> >> >

>> >> > That successfully changes the ownership on all directories and files

>> >> > below

>> >> > the d:\users\username but doesn't modify the top level directory

>> >> > itself.

>> >> > Then I ran this command (removing the *.*):

>> >> >

>> >> > subinacl /subdirectories D:\Faculty\Users\<username>

>> >> > /setowner=glastonburyus\<username>

>> >> >

>> >> > It modified the top level directory but then the script just hangs

>> >> > at

>> >> > the

>> >> > command prompt with blinking cursor without completing.

>> >> > What am I doing wrong?

>> >> >

>> >>

>> >> You're not listening, that's all! If you were listening then you'd

>> >> notice that your command does not "hang" - it wades through

>> >> all Faculty folders, causing a lot of disk grinding. Eventually it

>> >> will finish its job.

>> >>

>> >> Try this command instead: subinacl /file c:\Test /setowner=config

>> >>

>> >>

>> >>

>>

>>

>>


×
×
  • Create New...