For a while now I've been using a function to create random passwords in my PHP
webapplications. I've been using the following code: Random Pronounceable Password Generator
This function creates passwords that are more or less readable which is a big bonus, although I still ask my users to change it to something more memorable to them.
Anyhow, sometimes creating a password on the fly, one at a time, in a webapplication is just not enough and you want to create a bunch of them, say one hundred and fifty (as I had to do this week), so you can process them later and fill a csv
Enter the power of the commandline combined with PHP.
Download this file
and rename it to create_password.php. Put the file into your personal
directory: if that's not already there create a folder named
in your homedirectory. Make the file executable* and call it from the commandline.
If called just like this:
it will create ten passwords of ten characters each, but you can also tell it how many characters each password should have and how many to create:
create_password.php 6 25
. This will create 25 passwords of 6 characters each.
For extra fun of course you could pipe the output to other unix tools like sort, more, perl or whatever:
create_password.php 6 25 | sort | bbedit
*) To make a file executable open a Terminal window and type the following: (chmod
755). Put a space after that and drag the file from the Finder into the Terminal window, hit the enter key. After that is done simply drag the file from the Finder into the Terminal and add optional numbers for the length and number of passwords. Confirm with the enter key and you should see some random passwords to use as you see fit.
[oook:~] harold% create_password.php 7 5
†) I did say more or less readable.