Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
chkuser.pl -p <user name>
chkuser.pl -u <comment>
#! /usr/bin/perl -w
use strict;
use Getopt::Std;
sub printusage ()
{
print "Usage $0 -u <user name> | -p <PIN>\n";
exit 1;
}
my @hosts = qw ( host1 host2 host3 host4 host5 host6 );
my %uids;
my %opts;
getopt ( 'up', \%opts ) or printusage;
! defined $opts{'u'} and ! defined $opts{'p'} and printusage;
defined $opts{'u'} && defined $opts{'p'} and (print "Use either 'p' or 'u' flag\
n"), printusage;
exists $opts{'u'} and ! $opts{'u'} and (print "No user name passed with 'u' fla
g\n"), printusage;
exists $opts{'p'} and ! $opts{'p'} and (print "No PIN passed with 'p' flag\n"),
printusage;
foreach my $host ( @hosts )
{
foreach ( `ssh $host "cat /etc/passwd"` )
{
my ( $pin, undef, $uid, undef, $gecos ) = split /:/;
$opts{'p'} and $pin =~ /^$opts{'p'}$/ and print "$host,$pin,$uid,$gecos\n";
$opts{'u'} and $gecos =~ /$opts{'u'}/i and print "$host,$pin,$uid,$gecos\n";
$uid > 16000 and $uid < 17000 and $uids{$uid}++;
}
}
my $i;
for ( $i = 16001; $uids{$i}; $i++ ){}
print "Next free user id is ", $i, "\n";