Create Random Passwords with Linux

When creating user accounts on servers and devices, it is important to use strong passwords that will be difficult to guess or crack. It is often preferred to at least create accounts with a random password, and allow the user to change it to something they can remember. A great Linux tool for creating passwords is “pwgen”. Most distributions have “pwgen” available in their package management resources. To install the tool on Fedora, use:

[user@host ~]$ yum install pwgen

Once the package is installed, you will be able to start creating random passwords. Without any options specified, you will get an output such as:

[user@host ~]$ pwgen
woS2looh Aek6Ohph Ichoh7da shieD3ef Wopho2ri eeS3ahCo Tae8aigh Wu9fahfa
xi8eiLei uo5leiPh Neewah0G iRah1aiw Chahsh1Y Jeifa4ai Yei7si7o LeeV3ahl
aiHahw4a eine9Ew0 eYae6ohp IePhoo7u ieW9Oox0 ahXoo1eu Ziejeey5 yuJ1paiT
eXu4eidi aitho4Ta kei8ua6U ieY5oeza jaah7Ud0 foiD3zae ahng9Te6 ej4Aip2u
zaiW6shu Lai8UW2c eChoo1va EeRe9Ieh Ialiel2I thozie8D Dai9osee voofiSh5
geeJiey3 Gooz4aiw Uude5ooz faeW1wie Daitai9a Eewe7ceR aiPaic1X map5Iec6
bai6eeGo Oob0ohHo zaigh9He gaWie2uv EY5theij Sieloh2d Thei9yoh aev7Rele
gaew5Pov baixo8Ei Auch1aiN oa0On1th ewahZ1ze ohj9ooPh Eiph4fe3 HieGi5ga
ahs7eu6E ZugeiT1i FooCai1o ooZiex3a Hietee5e iedoCae2 co8Ooque piew4Oah
CailaG1e Jai2axee quaiSoo4 Geibah3u ir5tei1I ShaaXah3 Aikug5ee EeS4shu3
Eekoob9p Ro3Ou3ai ChieQu5u Kaish9ph Eu4Hohji upoY2ruB Phah7nei Quak6wah
Hein3eX3 Taeb5ahl zi2noRae hierei6F dae4Ahca phee4Pe2 ohWae0oi Oongo1ie
Wieshee6 ivahG3ir aeToh5cu We6es8xu Fohae9al oogae6Qu cu6Ohsha Av6Eeque
Axoigh9z Geemoqu8 Jee3oovi uGh3roPh ca5ShaeS xaeng5Ch ohX4Ohdi Raexe4ae
ohFei2Vo Raef7Eex LohxieS8 Um3thahz Oichee4M ieHeD8ah Ekoh7bai rie0sahV
faiz5Aij adua0Oad aTer7mao hohThoh6 fahM5boo ieXimi6w Oow6xai7 wooj2Goh
maeg5Foo Uodah8ei yahtei0A Ohch7uy6 Bo2osha6 Niehaz9I aehe3eXa shed2aaY
wiesh0Pu muiki3Oo eeF5eich hai0yeeH ahquae7A Weitah3I Thah1que ung4EG4U
pheW2joh ne4UuK3z sung7oeK pae0Ahli ujae8Pho rie2Oo5f thaTh6ci ahno6Moh
Eing5xai Voo4huod Sahl0Mei Ahn6aenu aer7Ohv4 uifish2I alae7Poo wohpou9O
[user@host ~]$

When using pwgen myself, I typically use the following options:

[user@host ~]$ pwgen 10 15 -s -B -C

This command gives me 15 passwords that are 10 characters long. The “-s” specifies to generate completely random, hard-to-memorize passwords. The “-B” specifies to not use characters that could be confused (i.e. “O” vs “0”). The “-C” requests the output to be formated in columns.
The other options can be found by using:

[user@host ~]$ man pwgen

More information can be found at:

Leave a Reply

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