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: rights misteriously changed
    ... All rights at the directory FAT1.... ... from one folder to another on the same drive. ... If you then do anything to the permissions the inherited ... Then create a file in F1 (it will inherit F1's ...
    (microsoft.public.windows.server.general)
  • 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)