File/Directory NTFS permissions

  • Thread starter Thread starter Oleg Ogurok
  • Start date Start date
O

Oleg Ogurok

Hi all,

Does anyone know how to set NTFS permissions on a file or a directory via C#
?
Thanks,

-O.
 
You have several options, remember, handling ACL's can be challanging,
therefore I would suggest you take a look at option 1.
1. Start cacls.exe using System.Diagnostics.Process.Start.
2. Use the System.Management and the WMI classes
'Win32_LogicalFileSecuritySetting' and 'Win32_Trustee'.
3. Use the System.DirectoryServices classes and the interop assembly built
from activeds.tlb.
4. Create a managed wrapper using ME C++ and call a bunch of WIN32 security
API's like GetNamedSecurityInfo, SetEntriesInAcl, SetNamedSecurityInfo ...

Willy.
 
Back
Top