473,249 Members | 1,401 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,249 software developers and data experts.

Inherented ACL's lost when adding a new ACE to a Share directory

Hello
I've got a very strange Problem. When im adding a new ACE entry to a UNC Direcotry the inherented ACL's will be lost. When I'm adding a new ACE to a directory / file in this UNC path the inherented ACE are still available.

What's wrong ? I don't understand the difference between \\server\share and \\server\share\directory while adding a ACE

AndyL

Sample:
\\myserver\myshare
Inherited ACE: Administrators, Network Service

After adding a ACE:
\\myserver\myshare
Inherited ACE: <empty>
ACE: myUser

Sample II:
\\myserver\myshare
Inherited ACE: Administrators, Network Service

After adding a ACE:
\\myserver\myshare
Inherited ACE: Administrators, Network Service

ACE: myUser

here is my code:
Expand|Select|Wrap|Line Numbers
  1.     class programm
  2.     {
  3.         static void Main(string[] args)
  4.         {
  5.             String dir1 = @"\\myserver\myshare";
  6.             String dir2 = @"\\myserver\myshare\test";
  7.             String usr = "myuser";
  8.             AddDirectorySecurity(dir1, usr , System.Security.AccessControl.FileSystemRights.FullControl, System.Security.AccessControl.AccessControlType.Allow);
  9.             Console.ReadKey();
  10.              AddDirectorySecurity(dir2, usr , System.Security.AccessControl.FileSystemRights.FullControl, System.Security.AccessControl.AccessControlType.Allow);           
  11.             Console.ReadKey();
  12.         }
  13.  
  14.         public static void AddDirectorySecurity(string FileName, string Account, FileSystemRights Rights, AccessControlType ControlType)
  15.         {
  16.             // Create a new DirectoryInfo object.
  17.             DirectoryInfo dInfo = new DirectoryInfo(FileName);
  18.  
  19.             // Get a DirectorySecurity object that represents the 
  20.             // current security settings.
  21.             DirectorySecurity dSecurity = dInfo.GetAccessControl();
  22.  
  23.             // Add the FileSystemAccessRule to the security settings. 
  24.             dSecurity.AddAccessRule(new FileSystemAccessRule(Account,
  25.                                                             Rights,
  26.                                                             ControlType));
  27.  
  28.             // Set the new access settings.
  29.             dInfo.SetAccessControl(dSecurity);
  30.  
  31.         }
  32. }
  33.  
Jun 20 '07 #1
0 1391

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: PengYu.UT | last post by:
Hi, I'm wondering why typename can not be inherented from base class. An example is shown below. If I have to typedef value_type anyway, I think it would be easier to define the 5 types in...
1
by: Sebastian Sosna | last post by:
Hello NG! Iam trying to write Access Control Settings for Users in Active Dir. First what i do is to delegate a Trustee in a Container, with permissions. This works fine. Lets take Guests as...
2
by: Ken Yee | last post by:
First a little background: I've written an httphandler to handle wildcard extensions (i.e., I want to handle all URLs that come in rather than just URLs w/ a specific file extension so I can give...
3
by: Jay-nospam | last post by:
Hi there, I am having trouble getting an ASP.NET web application to connect to another computer and passing the proper credentials and I hope someone can help me. I have a stand-alone Windows...
8
by: CM | last post by:
Hi, Could anyone please help me? I am completing my Master's Degree and need to reproduce a Webpage in Word. Aspects of the page are lost and some of the text goes. I would really appreciate it....
10
by: KarlM | last post by:
Hallo! Due to the help in this Newgroups I am now able to set basic rights to a Computer account in active directory. The following c#-Code works fine...
10
by: Nils Erik Dall | last post by:
Hi All I have a problem with my asp code on an iis 6.0 server on windows 2003 web. When I redirect between to asp pages on my web-site, where pageA is in a different virtual directory from pageB...
1
by: mastasmooky | last post by:
How can i get ACL for share folder?
1
by: Betray | last post by:
Well heres the set up. theres an AD set up in the office, every one has a login. now theres one folder lets call it g:\share in the AD server. right now, everyone must be logged in to view that...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.