Generate pretty secure random passwords

pwgen -Bnyc
These are my favourite switches on pwgen: -B Don't include ambiguous characters in the password -n Include at least one number in the password -y Include at least one special symbol in the password -c Include at least one capital letter in the password It just works! Add a number to set password length, add another to set how many password to output. Example: pwgen -Bnyc 12 20 this will output 20 password of 12 chars length.
Sample Output
yae[T3ae iM7ca[d9 joo*ro4K xoo}meF4 so{g9ohZ yohS&ah3 uu%X7jah fa|h7Wip
Siek'ei9 Oi:qu9ae uTh9gai[ Zei4ood: uRea7ab< Eequ[oo7 usa7pi|M Ooc(ei4d
Osh"equ7 Aip/ie3a ci)Ng7pi eiS3Vae] xoo4aaW. UTh3ahn[ yei^k9Ic Iu7Phah>
oas^iu9O voo4UaT' ooNg7oe| Xui"qu9o QuuT"oh7 buV9hei! inoo;N4E aiN,aex4
aighi%B7 Agh7tee! xo(fah3E Kah7aj\i ra9Aey(e aH[ai"y9 Oc(ai4Ee fe7MeX'u
ohj;ee3T osho*i7I Tai&Ng3e Koo,w?i3 ieB4Eef| Ahph:o4v VeiK+a4w oy3eeJ)u
ok9Fo>K^ oor!eeD4 aeR3phu& KiPo'ti4 woh&V3ox eiR!o4iz wooH*e9u Uef`oo9V
Ca9ein<e xa=na7Mo ooF"ie3W Eex;ai3c eiRai:z3 Si9sei&t eiY"ae7Z iH7eeG*o
UY7Pe@y7 que!X9th Eawiu"v4 Euxum$e4 Tua4Gie: os7bei<Z og=e4niR tho7Emo}
iey%uGa4 Awoh4se@ we3Weu@f Ahri>sh9 Ro7hu$uN ooGh,i9h Oow3ui*b ha9Ohr!a
sohD,ir9 UD<aePh7 roK4nai\ Jap7voh[ Voo9jei, wio4Vie< aQu7rah< bi.Geeg4
iu_koo9R Yu[th7yo Foh`d7yi Fok[ee9e zoo-ni4U Fah7aiZ! or!iah4H Ecae7xo-
OhS3Ef\i jooh7Be% OC3tei-M Eer3EeX| OiK}ah3p eeT7eov% aeN4Tho] uZ%io4ai
Pei|r9ai uuw;o7Oo gook/u9N iek[i4Ra Ies'oj7z Ahr_oo3e Aa9aiG@e ii.D7ohp
Yo$ce3wo coo"ph3I aex>ae9B IpooY}i9 wu3Thu%e Quei$H9g we9eM@uZ ooy4Ma#i
Pei=sh4r paiK&a7o eu7na^Pi dai@K3tu ooK!aen7 aD)a7dai oP'ij7Qu Aeng7ma-
aW9eezi< uu\vo4Ah kie=t9Pe eng7Eoj, eev9aeM" tah$qu7E eeHo|j4o Dahd>ee9
chuG:oh9 hi~k3ieP nah]C4ah jah4xaJ+ zooF`ai7 Ya@aY9fo EN]ohd7i ea3Chee%
Ee,f]i7i rau&K3Ce Ub7thah< eiN&ie9c Go7yuch! Aev3iqu$ ohr3EC*o oh7phu!W
ko3xae@C Oop&ee7i Iegh7ko- xo,Pie9h thee#Gu9 Boh+b4Ei ga4Je)qu eeV(o<s9

2012-03-15 14:38:15

What Others Think

Spoiler alert! date +%s | sha256sum | base64 | head -c 12 ; echo openssl rand -base64 9 < /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c${1:-12};echo; gpg --gen-random --armor 1 9
Habitual · 500 weeks and 5 days ago

What do you think?

Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?

You must be signed in to comment.

What's this? is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands

Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.


Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: