provide full permission to everyone at remote server by C#

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
I have to provide full access to everyone on folder at remote server where I am added as administrator.

Server: Window Server 2008 R2
I used following code to do this:
Code Snippet:
DirectorySecurity sec = Directory.GetAccessControl(path);<br/>
// Using this instead of the "Everyone" string means we work on non-English systems.
<br/>
SecurityIdentifier everyone = new SecurityIdentifier(WellKnownSidType.WorldSid, null);<br/>
sec.AddAccessRule(new FileSystemAccessRule(everyone, FileSystemRights.FullControl, InheritanceFlags.ContainerInherit | InheritanceFlags.ObjectInherit, PropagationFlags.None,
AccessControlType.Allow));<br/>
Directory.SetAccessControl(path, sec);

By using this I can see:
<img alt="" src="http://social.msdn.microsoft.com/Forums/getfile/174033
However on advance sharing tab it is:
<img alt="" src="http://social.msdn.microsoft.com/Forums/getfile/174034

Can anyone please help me with this issue?
Please let me know if you need more information.
Thanks,
Pradeep
<br/>

View the full article
 
Back
Top