473,387 Members | 3,750 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,387 software developers and data experts.

Checking Directory permissions for a user group

Hi All

I have the following directory structure.
A -
a1
a2
a3
B -
b1
b2
b3 -
bb1.c
bb2.h
bb3.xml
C -

I have to check the Read/Write permissions for a particular user group for the directories and files shown in the above directory structure.
I am still exploring the different possibilities. so havent yet tried anything on this.
Please let me know if anyone knows how to achieve this.

Thanks
Pramod
Jun 2 '08 #1
7 3711
numberwhun
3,509 Expert Mod 2GB
Hi All

I have the following directory structure.
A -
a1
a2
a3
B -
b1
b2
b3 -
bb1.c
bb2.h
bb3.xml
C -

I have to check the Read/Write permissions for a particular user group for the directories and files shown in the above directory structure.
I am still exploring the different possibilities. so havent yet tried anything on this.
Please let me know if anyone knows how to achieve this.

Thanks
Pramod
Well, being a learning forum AND the fact that this sounds distinctly like it is school work, we cannot do the work for you. Instead, you are going to have to first do the work and if you are stuck getting it to work, then post your code back to this thread and we will help you get it working. But, please know that it is against site policy for you to request the answers from us without having done anything first.

Regards,

Jeff
Jun 2 '08 #2
This is what i started with...As i m still exploring the possibilities, i wanted some information on this before i actually start working on this script. That is why i posted it in a hurry. otherwise i usually try out something first and then post(as Jeffin said).

Expand|Select|Wrap|Line Numbers
  1. use strict;
  2.  
  3. my @dirList;
  4.  
  5. system("cmd /C \"dir  /B /S  D:\\MyDir\\ \" > dirList.out");
  6. open(FH,"< dirList.out") or die($!);
  7. while(my $fileName = <FH>){
  8.     push(@dirList, $fileName);
  9. }
  10. close FH;
  11. foreach my $item ( @dirList){
  12.     print "\nITEM = $item";
  13.     chomp($item);
  14.     if ( not -w $item) {
  15.         die "directory $item is not writeable...Permission denied.\n";
  16.     }
  17. }
  18.  
But this will check write permissions only for the user who is running this script. I want to check for a different user in different user group (that too in WINDOWS). Are there any commands in windows to check for user group permissions?
Please help me.
Jun 3 '08 #3
KevinADC
4,059 Expert 2GB
Don't waste too much effort on this question Jeff:

http://forums.devshed.com/perl-programming-6/checking-directory-permission-for-user-group-534325.html
Jun 3 '08 #4
Hi
Here is the script using which I am able to get some user information.

Expand|Select|Wrap|Line Numbers
  1. use Win32::Perms;
  2.  
  3. # Create a new Security Descriptor and auto import permissions
  4. $filedir = 'C:\temp';
  5. if( -e $filedir ) {
  6.     print "\n $filedir Exists...";
  7. }
  8. else {
  9.     print "\n $filedir Doesn't exists...";
  10. }
  11. $Dir = new Win32::Perms( $filedir ) || die "Unable to create Perms Object";
  12. # dump the contents to STDOUT
  13. $Dir->Dump;

This will give me the following output.
Expand|Select|Wrap|Line Numbers
  1.  C:\temp Exists...
  2.  
  3. Descretionary ACL:
  4. Index Account                                  Mask       Type       Flag
  5. ----- ---------------------------------------- ---------- ---------- ----------
  6.     0 CODE1\ing03125                           0x001200a9 Allow      0x00000003
  7.     1 BUILTIN\Administrators                   0x001f01ff Allow      0x00000010
  8.     2 BUILTIN\Administrators                   0x10000000 Allow      0x0000001b
  9.     3 NT AUTHORITY\SYSTEM                      0x001f01ff Allow      0x00000010
  10.     4 NT AUTHORITY\SYSTEM                      0x10000000 Allow      0x0000001b
  11.     5 CREATOR OWNER                            0x10000000 Allow      0x0000001b
  12.     6 BUILTIN\Users                            0x001200a9 Allow      0x00000010
  13.     7 BUILTIN\Users                            0xa0000000 Allow      0x0000001b
  14.     8 BUILTIN\Users                            0x00000004 Allow      0x00000012
  15.     9 BUILTIN\Users                            0x00000002 Allow      0x00000012
  16.  
  17.  
  18. System (auditing) ACL:
  19. Index Account                                  Mask       Type       Flag
  20. ----- ---------------------------------------- ---------- ---------- ----------
  21. This is a NULL SACL. This means that no auditing is taking place.
  22.  
  23.  
  24. Owner: 
  25.       Account                                 
  26.       ----------------------------------------
  27.       BUILTIN\Administrators
  28.  
  29.  
  30. Group: 
  31.       Account                                 
  32.       ----------------------------------------
  33.  
  34.  
  35. Total: 10 ACE entries
But it is very difficult to understand the Mask code.
Please let me know is there any way by which i can get the human readeable information out of it?
I tried to decode the mask information using this link : http://www.roth.net/perl/perms/
Jun 10 '08 #5
I am still waiting for suggestions/alternatives.
Jun 11 '08 #6
numberwhun
3,509 Expert Mod 2GB
I am still waiting for suggestions/alternatives.
To tell you the truth, I have no idea. If I were you, I would start reading everything I could over at the Roth Consulting site where you got the module from (as its not part of CPAN). If you have any questions, maybe they can provide the answers for you.

Regards,

Jeff
Jun 11 '08 #7
Thanks Jeff. I have sent a mail to Roth Cons. Lets see if i get any reply, i will post the answer in this forum.

But in general, its so easy to get user group info through GUI. I mean there must be some module in PERL which will talk to Windows API to get user info.
which module of CPAN do you suggest to get user group info? I couldn't get any. I tried all this:
http://www.netadmintools.com/art33.html
http://www.roth.net/perl/perms/
win32::Security etc.

Please let me know if anyone can help me to get this info. Its very urgent for me.

Thanks
Pramod
Jun 12 '08 #8

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

Similar topics

15
by: scmiles | last post by:
I am trying to write an asp or aspx page that will create a virtual ftp directory to the users Active Directory home directory. That way a user can interact (drag/drop, copy/paste) via IE with...
6
by: JerryP | last post by:
Hello, is there a way to launch the property dialogue for a directory from my c# app ? I would also like to launch the User Account Properties from Active Directory Users and Computers, and the...
2
by: Hari | last post by:
Hi I have an ASP.NET application that writes to a log file in a directory outside the webapp directory (e.g. c:\program files\myapp\logs). OS is Windows 2003 If I see the list of users in the...
1
by: blue | last post by:
Is there a way to check if the currently logged in user has access to a particular directory or file on the web server? I've been researching this and have run into suggestions of using P/Invoke...
5
by: J'son | last post by:
<REPOSTED> Guys, I need to build a web intranet application that can automatically create a user account when a new user registers on the site. The user account will be on the web server,...
27
by: Javier Martinez | last post by:
Hi I have asp application in a machine with a virtual directory referring a shared directory in another machine When I try to load any aspx page of my portal I get the following error: ...
2
by: Scott | last post by:
I'm creating an intranet site that uses Forms authentication to validate users against an Active Directory. Users need to be able to login both from work and remotely. Then I want to be able to do...
7
by: sprash | last post by:
Newbie question: I'm trying to determine if a file physically exists regardless of the permissions on it Using File.Exists() returns false if it physically exists but the process does not...
65
by: Hongyu | last post by:
Dear all: I am trying to write to a file with full directory name and file name specified (./outdir/mytestout.txt where . is the current directory) in C programming language and under Unix, but...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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...

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.