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.
#!/usr/bin/perl -w
# I borrowed the following routine to generate a random string from the author credited
###########################################################
# Written by Guy Malachi [URL unfurl="true"]http://guymal.com[/URL]
# 18 August, 2002
###########################################################
# This function generates random strings of a given length
sub generate_random_string
{
my $length_of_randomstring=shift;# the length of
# the random string to generate
my @chars=('a'..'z','A'..'Z','0'..'9','_');
my $random_string;
foreach (1..$length_of_randomstring)
{
# rand @chars will generate a random
# number between 0 and scalar @chars
$random_string.=$chars[rand @chars];
}
return $random_string;
}
open (FOUT,">passwordlist.txt");
# My code now. Save the perl code as "massuseradd.pl"
# Call this perl program with
# perl massuseradd.pl < listofusernames.txt
while (<>) {
print "Processing Account Name: $_\n";
print "Creating Group: $_\n";
exec ("groupadd $_");
print "Creating User: $_\n";
exec ("useradd -G $_ $_");
# Generate the random string
my $random_string=&generate_random_string(11);
print "Setting Password for user: $_\n";
print "You need to copy/paste or enter the password: $random_string\n";
exec ("passwd $_");
print FOUT "$_ --- $random_string";
print "Done with user: $_\n---\n";
}
close FOUT;
# NOTE: This uses untested code and EXTREMELY POOR SECURITY PRACTICES.
# It is very bad to write out a master text file of users and passwords
# It is also very bad practice for the admin to see/enter every new password.