views:

10

answers:

0

I use Window 2003 server, and I need get information about security folder, programatically using C#.

I want create a tool for check permissions. I need get the groups, users, permissions and special permissions for a folder,

C:\Documents and Settings\All Users\Application Data\Microsoft\Crypto\RSA\MachineKeys

edit:

the following is a sample code for the GetSecurityDescriptorSddlForm method.

    public static string GetObjectPermission(string fullFolderName)
    {
        FileSecurity fileSecure = File.GetAccessControl(fullFolderName);
        StringBuilder acer = new StringBuilder();
        fileSecure.GetSecurityDescriptorSddlForm(AccessControlSections.All);

        foreach (FileSystemAccessRule ace in fileSecure.GetAccessRules(true, true, typeof(NTAccount)))
        {
            acer.Append(ace.FileSystemRights +":" + ' ' + ace.IdentityReference.Value+"\n");
        }
        return acer.ToString();
    }

This sample code will show you which NTAccount can modify or read the folder, such as this function.

How can I get groups and special permissions ??

any sample code, suggestions?