Skip to content

Instantly share code, notes, and snippets.

@rushipkar90
Created September 25, 2015 16:32
Show Gist options
  • Save rushipkar90/11c8f32debcbb7476fa3 to your computer and use it in GitHub Desktop.
Save rushipkar90/11c8f32debcbb7476fa3 to your computer and use it in GitHub Desktop.
findBadOwners.pl
#!/usr/bin/perl
my $user;
for $user (`ls /var/cpanel/users/`) {
chomp($user);
my @userinfo = getpwnam($user);
my $homedir = $userinfo[7];
my $uid = $userinfo[2];
my $result = `find $homedir ! -uid $uid ! -uid 99 ! -uid 65535 ! -uid 0 -exec ls -l {} \\\;`;
if ($result) {
open ($fh, ">/root/corruption/$user.txt");
print $fh $result;
close ($fh);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment