When I need to set an initial password for someone at the office, I turn to this simple program:
use strict;
use warnings;
my @alphabet = ( '0' .. '9', 'a' .. 'z', 'A' .. 'Z' );
my $length = shift @ARGV || 8;
my $out = '';
while ( length $out < $length ) {
$out .= $alphabet[ rand @alphabet ];
}
print "$out\n";
A coworker remarked recently, "you're really not trying to make this easy, are you." Well, no.
This evening I thought about golfing this down to a one liner to make it easier to paste into a chat, and this is what I came up with:
perl -E '@a=("0".."9","A".."Z","a".."z");$o.=$a[rand@a]while 8>length$
+o;say$o'
I don't doubt that this could be improved greatly. Any monk who wants to play along should try to generate passwords of 8–15 characters from an alphabet that includes letters and non-letters (/\w/ and /\W/). The more secure the results, the better.
I'd consider a side discussion of manual password selection methods also to be on topic. My personal favorite is to take the initials of some phrase that I can recall reliably, usually a quote from a movie or a song lyric ("happy birthday to you" would be "hb2U"). At a company I used to work for, we'd set root on all the machines using different parts of a single song. If I was caught without my password list, I could go through the song phrase by phrase and find the password to whatever I was trying to access. That didn't happen much since I had the most commonly used ones memorized in a day or two.