PLEASE HELP
I have a remote server (say srv1) in there I have 3 folders (directories). Number of users and groups has been granted access to all or some off the directories/sub-directories (I have full rights to the server). I need to write a script that removes the ‘Everyone’ account access wherever was found in any dir/sub-dir on that remote server without remove any other account.
The following is the code I have written.
$dir-> Remove (-1) ie resetting all perms works but when I try to remove the Everyone group it failes (no errors given) just hangs, cna some please pleasaee tell whats iam doing wrong?
And can extract the information of the SAM and modify the permission for Everyone account access instead of using Wine32::Perms?
use warnings 'all'; use Win32::Perms; use Win32::NetAdmin; my $srv = shift @ARGV; my $drv = pop @ARGV; my $unc_path = "\\\\" . $srv . "\\" . $drv . "\\"; print "\nServer\t: $srv\nDrive\t: $drv\nUnc\t:$unc_path\n"; my $file_counter = 1; &proccess_dir ("$unc_path"); sub proccess_dir { my ($dir_name) = @_; my ($file, $sub_dir, $file_var); $file_var = "CONST" . $file_counter++; opendir ( $file_var,"$unc_path") || warn "\n$! : $unc_path\n"; print "$dir_name\n"; $dir = new Win32::Perms ($dir_name) || return 0; $dir -> Dump; print "\n\n\n***********************************\n\n\n"; $dir -> Remove ('everyone');# it hangs here forever $dir -> Set ( ); $dir -> Dump; while ( $file = readdir ( $file_var ) ) { next if ( $file eq "." || $file eq ".." ); } rewinddir ( $file_var ); while ( $sub_dir = readdir ( $file_var ) ) { next unless (-d ( $dir_name . "/" . $sub_dir ) ); next if ( $sub_dir eq "." || $sub_dir eq ".." ); &proccess_dir ($dir_name . "/" . $sub_dir ); } closedir ( $file_var ); }

In reply to Removing Permissions by blackadder

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.