Generate random passwords using Perl

By | November 7, 2008

If you have a server where you have to generate new passwords daily, the following script can automate the process:

#!/usr/bin/perl
my @alphanumeric = (‘a’..’z’, ‘A’..’Z’, 0..9);

my $randpassword = join ”, map $alphanumeric[rand @alphanumeric], 0..8;
print “$passwordgen\n”

Run it with ./passwordgen.pl and it will generate random strings of charaters and numerals, 8 characters long: lf78A7xv

Leave a Reply

Your email address will not be published. Required fields are marked *