473,546 Members | 2,239 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

setting and retrieving NTFS permissons for local groups and users

Neo
Hi Everyone
I am trying to set and retrieve NTFS permssions for
fileshares on remote machine using ActiveDs Interop. It works for domain
groups and users but when try to retrieve permssions for local groups and
users it gives me dangling SIDs. While setting permssions how can I indicate
whether the user or group is local or a domain group ?.
Following is the code snippet I am using for retrieving permissions

string folderPath = @"\\machinename \e$\test";

IADsAccessContr olList daclnew ;

ADsSecurityUtil ityClass secuUtil = new ADsSecurityUtil ityClass();

//Getting security decriptor

object ob = secuUtil.GetSec urityDescriptor (

folderPath,

(int)ActiveDs.A DS_PATHTYPE_ENU M.ADS_PATH_FILE ,

(int)ActiveDs.A DS_SD_FORMAT_EN UM.ADS_SD_FORMA T_IID

);

ActiveDs.IADsSe curityDescripto r securitydescrip tor =
(IADsSecurityDe scriptor)ob;

ActiveDs.IADsAc cessControlList obDacl = ( ActiveDs.IADsAc cessControlList )

securitydescrip tor.Discretiona ryAcl;

daclnew = (IADsAccessCont rolList)obDacl;

foreach(IADsAcc essControlEntry entry in daclnew)

{

if( entry.AceType == (int)ADS_ACETYP E_ENUM.ADS_ACET YPE_ACCESS_ALLO WED )

{

Console.WriteLi ne( entry.Trustee );

}

}
Following is the code snippet I am using to set permssion:

ADsSecurityUtil ityClass secuUtil = new ADsSecurityUtil ityClass();

//Getting security decriptor

object ob = secuUtil.GetSec urityDescriptor (

folderPath,

(int)ActiveDs.A DS_PATHTYPE_ENU M.ADS_PATH_FILE ,

(int)ActiveDs.A DS_SD_FORMAT_EN UM.ADS_SD_FORMA T_IID

);

if ( null != ob )

{

ActiveDs.IADsSe curityDescripto r securitydescrip tor =
(IADsSecurityDe scriptor)ob;
if( allowTrusteeLis t != null )

{

for( int trustee = 0; trustee < allowTrusteeLis t.Length; trustee++ )

{

ActiveDs.IADsAc cessControlList obDacl = (
ActiveDs.IADsAc cessControlList )

securitydescrip tor.Discretiona ryAcl;

Allow = new AccessControlEn tryClass();

//For recursive security settings

Allow.AceFlags = 3;

//ACE is allow type

Allow.AceType = (int)ADS_ACETYP E_ENUM.ADS_ACET YPE_ACCESS_ALLO WED;

//storing trustee

Allow.Trustee = SetSecurityTrus tee( allowTrusteeLis t[trustee] );

//Allow.Trustee = allowTrusteeLis t[trustee];

AppendLog( 1, "Creating allow accessmask for trustee: " +
allowTrusteeLis t[trustee] );

//creating access mask

if( !CreateAccessMa sk( Allow, true, trustee ) )

{

return false;

}

obDacl.AddAce(A llow);

}


Nov 15 '05 #1
0 1808

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
8002
by: BingoHandJob | last post by:
Hello group! I'm having a problem and I hope some of you may be able to point me in the right direction. I inherited a web site using php, running on Windows 2000 & IIS. The site was developed by a consulting firm about a year before I came on board, the consultant has since gone out of business. Overall, I've never had a problem with...
2
1793
by: travelling_nerd | last post by:
Folks: I have some zip files I'd like to serve to authenticated users on my site, but would like to prevent unauthorized users from using an absolute path to get to these zip files. For example http://blah.com/file.zip should not be accessible directly without authenticating. However, my current authenticaion goes to an LDAP server and I'd...
3
1451
by: Kim Lots | last post by:
Hi folks Let say I have one virtual directory (IIS 5.x) pointing to a folder on my G: drive what would be the minimum NTFS permissions (w2k pro) for users & groups on this folder considering I'm running ASP 3.0 with an Access DB? Tia
5
1738
by: travelling_nerd | last post by:
Hi, I'm trying to write a script that will allow validated users to download a file that has specific ntfs permissions. Here's a summary: Scenario: 1) The name of the file is "binary.zip". 2) I've created a local account on the server called "dl_user". 3) dl_user is the only account that has permissions on binary.zip. 4) I've written a...
1
3879
by: tangus via DotNetMonster.com | last post by:
Hello all, I'm really struggling with getting some Active Directory code to work in ASP.NET. Can you please provide assistance? I am executing the following code: Dim enTry As DirectoryEntry = New DirectoryEntry("LDAP://domain") Dim mySearcher As New DirectorySearcher(enTry) Dim resEnt As SearchResult mySearcher.Filter =...
0
7912
by: Johan | last post by:
Hi I'm using WMI to set and remove folderpermissions and it sems to work fine, sometimes. I start by having the folderpermissons manuly set to Everyone and Everone has full rights. When I'm setting and removing permissons on a mapped folder in the network it works fine but when doing the same thing on a folder om my harddrive Everyone does...
1
6455
by: laredotornado | last post by:
Hi, I'm using PHP 4.4.4 on Apache 2 on Fedora Core 5. PHP was installed using Apache's apxs and the php library was installed to /usr/local/php. However, when I set my "error_reporting" setting to be "E_ALL", notices are still not getting reported. The perms on my file are 664, with owner root and group root. The php.ini file is located...
0
1418
by: Mean | last post by:
Hello, I'm just writing a script that creates Groups in the AD. This groups are named by a special name convention (for our firm). I also set the "Scope of Group". Everything works very nice. Now I want to set NTFS permissions on the new build group and I tried using this: Const UF_WORKSTATION_TRUST_ACCOUNT = &H1000 Const...
8
4419
by: Michael Howes | last post by:
I have some code that manages local user logins. When I create a new user I want to set the password to expire every x days and the number of failed login attempts before the account is disable/locked out. I can't seem to figure out how. I saw two properties in MSDN BadPasswordAttempts and MaxPasswordAge but I can't seem to set them on the...
0
7504
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7947
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
6026
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5360
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5080
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3491
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3470
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1921
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1046
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.