Re: adding share permissions via a batch file

From: Herb Martin (news_at_LearnQuick.com)
Date: 03/06/05


Date: Sat, 5 Mar 2005 21:54:09 -0600


"Nathan H" <annonymous@discussions.microsoft.com> wrote in message
news:OAXCMEfIFHA.276@tk2msftngp13.phx.gbl...
> Hi all
> It may have been covered before and I apologize if it has but does
> anyone know a way of assigning full *share* permissions to the user you
> are creating via a batch file?

Sure but that is generally the wrong approach.
(Depends on the OS whether it is built in or
not, but even then you can use the free SetAcl.exe
from SourceForge.net.)

> i.e.
> I create the folder \\servername\%username%$ (for the users home dir)

Usually permissions should be handled by groups,
and each user should NOT have a separate share
but only a directory within the share for groups of
users, (e.g., all Engineers or even all users.)

> Now, I can assign the NTFS permissions fine with cacls like this (as an
> example):
> cacls d:\homedir\%username% /t /e /c /g %username%:f
>
> (don't worry about the above syntax - I've had a few drinks hehe)
>
> I just cant seem to find a way of assigning share permissions using any
> sort of command.

Share permissions were added to "net share" in
Win2003 server but SetAcl.exe can still set them
for older operating systems.

Caveat: SetAcl has the most irrating command line
of any Windows utility I know.

> As the script is so I can process a list of user's to add, it's a little
> annoying after adding a load of users to a AD which has worked fine -
> having to go and manually change each of the share permissions from:

> Everyone - Read Only
> to:
> Everyone - Full Control

And that is likely a poor choice for permissions,
especially since you were creating these for each
user.

> (i don't want a discussion on whether this is right or wrong however -
> just a way of doing it using some command line tool in a normal bat/cmd
> scripted way)

If you ask you get the whole answer since it would
mislead others to tell you how to do something without
giving the full story.

> Many thanks to anyone that can give me a hand with this :)

SetAcl.exe

-- 
Herb Martin
>
> Regards,
> Nathan H.
> Network Administrator - Ysgol Bro Ddyfi (Edu)


Relevant Pages

  • Re: Deploying Software with Computer GPO Errors
    ... Nathan I recommend you to try with Share Permission everyone full control ... >> Microsoft MVP - Directory Services ... set the permissions on the share with Administrators having ... Setup the Software Installation default location to the ...
    (microsoft.public.win2000.active_directory)
  • Re: Deploying Software with Computer GPO Errors
    ... I hope that you are dreaming of Active Directory (and ... > Nathan I recommend you to try with Share Permission everyone full control ... >> Computers to both the share and folder permissions as well as the ...
    (microsoft.public.win2000.active_directory)
  • Re: adding share permissions via a batch file
    ... "Nathan H" wrote in message ... > It may have been covered before and I apologize if it has but does ... Usually permissions should be handled by groups, ... SetAcl has the most irrating command line ...
    (microsoft.public.windows.server.general)
  • Re: ubuntu-users Digest, Vol 47, Issue 208
    ... Superuser confusion or maybe critically confused ... "Permissions" appears nowhere in Nautilus, so far as I can tell. ... I am attempting to learn to use command line. ...
    (Ubuntu)
  • Re: Isolate home directory shares
    ... I believe the command for one subfolder would be similar to: ... removes the inheritance flag but leaves existing permissions for the ... home directories are done with ADUC using profile tab: ...
    (microsoft.public.windows.server.general)

Quantcast