Setting directory NTFS directory permissions (W2k3 Server)



Hi all,

Using C#, does anyone know how I can manipulate the file permissions on a
folder I've just created such that the folder does not inherit permissions
from its parent.
My code currently has a number of lines that look something like:

dSecurity.AddAccessRule(new FileSystemAccessRule(sid,
FileSystemRights.FullControl,
InheritanceFlags.None,
PropagationFlags.NoPropagateInherit,
AccessControlType.Allow));


There is one line for each sid for which I want to set permissions.

The variable sid is, as you would imagine, a security identifier. This
works fine, except that these permissions are added to the inherited
permissions, whereas I want to replace the existing (inherited) permissions.
The programme is scheduled to replace an existing script which calls xcacls
like this:

xcacls \\centralcy03\users\student\edu\dv06004249\profile /P "Domain
Admins":F dv06004249:F ITAdvisors:F /T /Y,1,true

This appears to replace all existing permissions, which is what we want.

Many thanks,




Peter


.



Relevant Pages

  • Re: How to set folder private?
    ... If the check boxes under Permissions for user or group are shaded or if the ... then the file or folder has inherited ... permissions from the parent folder. ... are created in the folder inherit these permissions. ...
    (microsoft.public.windowsxp.security_admin)
  • Re: NTFS - Restrict file deletion
    ... NTFS permissions are XP standard. ... File is in folder. ... the Admin from deleting a file or folder. ... check on "Inherit from Parent...", click Apply, click ...
    (microsoft.public.windowsxp.general)
  • Re: NTFS - Restrict file deletion
    ... NTFS permissions are XP standard. ... File is in folder. ... the Admin from deleting a file or folder. ... check on "Inherit from Parent...", click Apply, click ...
    (microsoft.public.windowsxp.general)
  • Re: Sharing
    ... > I apologize for the previous posting which applies for Windows XP Pro. ... > Permissions for Files and Folders ... > How Inheritance Affects File and Folder Permissions ... > are created in the folder inherit these permissions. ...
    (microsoft.public.windowsxp.security_admin)
  • Re: Need help with Shared drives and permissions
    ... If the option to change the permissions are ... greyed out then that folder is inheriting. ... By default all folders inherit. ... some of my user must be members of a group who have the permissions ...
    (microsoft.public.windows.server.general)