Subversion Repositories sysadmin_scripts

Rev

Rev 149 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

#! /usr/bin/env perl

use strict;
use warnings;

use File::Slurp; # apt install -y libfile-slurp-perl

my @users;

my @passwords = read_file( '/etc/passwd' );
while ( my $line = pop @passwords ) {
   next if $line =~ m/^#/;
   my @columns = split( ':', $line );
   push @users, $columns[0] if $columns[2] >= 1000 && $columns[2] < 65534;
}

#print join( "\n", @users );

my $users = join( '\|', @users );
print qx/ps aux | cut -d' ' -f1 | sort | uniq | grep '$users'/;

1;