Buffer_z Buffer_z - 1 year ago 125
C# Question

retreive and set NTFS permissions using c#

I m confused how can i retreive and set the NTFS permission for a directory using c#

such as Save

file Stream
and save
file security

I'm looking for how can i save those properties for an executable so that it's stream cannot be modified .

Answer Source

System.Security.AccessControl.FileSecurity would be the place to start.

See the example on that page using File.GetAccessControl method to get an instance.


it's stream cannot be modified .

ACLs can always be overridden (not least my anyone with the Take Ownership privilege: as all local administrators have). If you want to ensure an exe is not modified you would be better looking at code signing.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download