c# - read permission denied using NTFS when I denied write permission -
Using the code given below did not ask for a user permission to write, even if I checked the Security tab But the permission to write only has been rejected, but I can not be able to use the 'folder to read.
ADSOCITY objADsSec; Securitydesktop objSecDes; AccessControlList objDAcl; AccessControlEntry objAce1; AccessControlEntry objAce2; Object objSIdHex; ADSID OGSID; ObjADsSec = new ADSSecurityClass (); ObjSecDes = (Security Descriptor) (objADsSec.GetSecurityDescriptor ("FILE: //" + vPath)); ObjDAcl = (AccessControlList) objSecDes.DiscretionaryAcl; ObjSId = new ADsSIDClass (); ObjSId.SetAs ((int) ADSSECURITYLib.ADS_SID_FORMAT.ADS_SID_SAM, Username.Testring ()); ObjSIdex = objSId.GetAs ((int) ADSSECURITYLib.ADS_SID_FORMAT.ADS_SID_SDDL); ObjAce2 = New AccessControlEntryClass (); ObjAce2.Trustee = (objSIdHex) .restring (); ObjAce2.AccessMask = (int) ActiveDs.ADS_RIGHTS_ENUM.ADS_RIGHT_GENERIC_WRITE; ObjAce2.AceType = (int) ActiveDs.ADS_ACETYPE_ENUM.ADS_ACETYPE_ACCESS_DENIED; ObjAce2.AceFlags = (int) ActiveDs.ADS_ACEFLAG_ENUM.ADS_ACEFLAG_INHERIT_ACE | 1; ObjDAcl.AddAce (objAce2); ObjSecDes.DiscretionaryAcl = objDAcl; // NTFS file system folder set permissions ObjADsSec.SetSecurityDescriptor (objSecDes, "FILE: //" + vPath);
you are not showing objAce1
to order you Need ACA entries to deny ACI entries.
Try to swap the sequence of entries in ACL.
In this way, AAC should list the DACL should be given the appropriate order, clearly denies the standard (canonical) ordering, then explicitly permits, the general (group) denies , And the group allows. If the use of an orthodox order is not used, then unexpected allows or may be rejected
to
Comments
Post a Comment