Instantly share code, notes, and snippets.

Embed
What would you like to do?
#!/usr/bin/perl -w
my $change=0;
my %uids=(
1234=>4567,
);
my %gids=(
5432=>2345,
);
my (undef,undef,undef,undef,$uid,$gid,undef,undef) = stat($ARGV[0]);
if(defined($uids{$uid})) {
$uid=$uids{$uid};
$change=1;
}
if(defined($gids{$gid})) {
$gid=$gids{$gid};
$change=1;
}
if($change==1) {
chown $uid, $gid, $ARGV[0];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment