Hi All,
and here is my two cents worth...
This is a piece of code I am using to do a similar thing.
I had to use the hex values for the permissions otherwise it showed up as
special access. This is for change control on the directory and the file.
sub addperms
# Add the NT permissions to the directory
{
$permpath = "\\\\" . "$servername" . "\\" . "home" . "\\" . "$userid";
$hmedir = new Win32::Perms( "dir:$permpath") || die "\nOops Can't find path
for perms:$!";
$hmedir->Dump;
$hmedir->Remove('users');
$hmedir->Add("$userid", 0xe0010000, ALLOW, FILE);
$hmedir->Add("$userid", 0x001301bf, ALLOW, DIRECTORY);
$hmedir->Dump;
$hmedir->Set();
}
Regards,
Hemant
>From: "Dean Theophilou" <[EMAIL PROTECTED]>
>To: "Thomas Schmidt" <[EMAIL PROTECTED]>,
>"[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
>Subject: RE: Win32-Perm - Question
>Date: Wed, 15 Aug 2001 13:37:23 -0700
>
>Hi Thomas:
>
> Here is code snippet from one of my scripts that sets the NTFS permissions
>on a user's HOME directory to (RX)(RX) for the user, while removing a group
>that I didn't want to have access:
>
>$Path = 'dir:' . "\\\\Server\\Home\\$UserName";
>
>$PermDirFlag = DIRECTORY;
>$PermDirMask = READ | EXECUTE;
>
>$PermFileFlag = FILE;
>$PermFileMask = READ | EXECUTE;
>
>$HomeDir = new Win32::Perms($Path) ||
> warn "Cannot create new permissions object: $!\n";
>
># this sets the user's directory permissions
>$HomeDir->Allow($UserName, $PermDirMask, $PermDirFlag);
>
># this sets the user's file permissions within the above directory
>$HomeDir->Allow($UserName, $PermFileMask, $PermFileFlag);
>
># this removes a group's permissions
>$HomeDir->Remove("Group"); # only the user should have access.
>
># this applies the above permissions to the object
>$HomeDir->Set();
>
>
> I make no claims about the elegance (or lack, thereof) of this code, but,
>hey, it works. :) Also, since I'm new to Perl, my explanations my not be
>100% technically correct. Nevertheless, like I said, the above code works
>for me. I hope this helps.
>
>
>Dean Theophilou
>Genisar
>
>-----Original Message-----
>From: [EMAIL PROTECTED]
>[mailto:[EMAIL PROTECTED]]On Behalf Of
>Thomas Schmidt
>Sent: Wednesday, August 15, 2001 4:55 AM
>To: [EMAIL PROTECTED]
>Subject: Win32-Perm - Question
>
>
>Hello,
>
>I am triing to set File- and Directory-Permissions with Dave Roth�s
>Win32::Perm - Module. The following script sets an ACL to the file
>test.txt correctly.
>But the sript dont�t work with the directory "c:/temp".
>The ReadMe file says, that I have to use a Prefix with the directorys
>path, but I dont know the correct way.
>
>Thanks for your help.
>Thomas
>
>
>
>use Win32::Perms;
>
> $File = new Win32::Perms; # Create empty ACL�s
> $Dir = new Win32::Perms;
>
> $File->Add({Account=>'co', Mask=>READ}); # Add an account to the
>ACL
> $File->Set("c:/tmp-rechte/test.txt"); # Set the
>file's permissions
>
>
># the files ACLs are modified correctly
> $Dir->Add({Account=>'co', Mask=>READ});
> $Dir->Set("c:/temp");
>
># the directories ACLs are not modified
>
>
>
>
>_______________________________________________
>Perl-Win32-Admin mailing list
>[EMAIL PROTECTED]
>http://listserv.ActiveState.com/mailman/listinfo/perl-win32-admin
>
>_______________________________________________
>Perl-Win32-Admin mailing list
>[EMAIL PROTECTED]
>http://listserv.ActiveState.com/mailman/listinfo/perl-win32-admin
_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp
_______________________________________________
Perl-Win32-Admin mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-admin