Easy password generating under OS X
I generate a loooot of passwords. I try out a lot of webservices and all those needs passwords. I control about 70-100 servers and all those have different services and accounts. So I generate a lot of passwords… and this post is about how I do it do make it as easy as possible.
Using pwgen out-of-the-box
I use pwgen (http://sourceforge.net/projects/pwgen/) to generate my passwords. pwgen can be downloaded from sourceforge or installed from MacPorts.
I used to have an alias that looked something like this
alias pwgen='pwgen 15'
This command will generate a screen of passwords and I the use the mouse to double click on some random password. This have been great but requires me to move my hand to the mouse which is time consuming.
Getting rid of the mouse
So to get rid of the mouse I have created this alias which generates one password and the copies the password to the clipboard.
alias pwgen="pwgen -N1 -s 15 | tr -d '\n' | pbcopy ; echo 'Password copied to clipboard.'"
So my workflow becomes something like shift focus to Terminal with ⌘ + Tab and then create a new window with ⌘ + N.
Write pwgen and then close the window with ⌘ + W and then I am back where I started with a fresh password in my clipboard.