473,395 Members | 1,949 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,395 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 1397

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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.