Tuesday, March 27, 2012

List NTFS folder permissions

I believe it is possible to add/edit/delete and retrieve acls using .net 2.0
The key thing I need to do for now is retrieve a list of NTFS permissions fora given folder, (and as part of this, check what access the currentlylogged in user has to said folder)
I can't find a clear tutorial anywhere so any help would be much appreciated!
Regards
Jon
Hi folks
Any ideas re this? I'm still struggling with it!

Did you check the System.Security.AccessControl namespace?
http://msdn2.microsoft.com/library/tbsb79h3(en-us,vs.80).aspx
As a last resource, you can always pinvoke native APIs.

[DllImport("advapi32.dll", CharSet=CharSet.Auto)]
static extern uint GetNamedSecurityInfo(
string pObjectName,
SE_OBJECT_TYPE ObjectType,
SECURITY_INFORMATION SecurityInfo,
out IntPtr pSidOwner,
out IntPtr pSidGroup,
out IntPtr pDacl,
out IntPtr pSacl,
out IntPtr pSecurityDescriptor);

0 comments:

Post a Comment