Buffer_z Buffer_z - 3 days ago 4x
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 .


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.