Generate passwords using Pwgen on Linux and macOS
Intro
Pwgen is a password generator for creating easily memorable passwords. I stumbled across this tool and found it to be one of the best for Linux and macOS.
Installation
Arch Linux
$ pacman -S pwgen
Most Linux distributions should have a package management system with pwgen
in their own repositories.
macOS
$ brew install pwgen
Pwgen is also available in MacPorts.
Usage
$ pwgen -h
Usage: pwgen [ OPTIONS ] [ pw_length ] [ num_pw ]
Options supported by pwgen:
-c or --capitalize
Include at least one capital letter in the password
-A or --no-capitalize
Don't include capital letters in the password
-n or --numerals
Include at least one number in the password
-0 or --no-numerals
Don't include numbers in the password
-y or --symbols
Include at least one special symbol in the password
-s or --secure
Generate completely random passwords
-B or --ambiguous
Don't include ambiguous characters in the password
-h or --help
Print a help message
-H or --sha1=path/to/file[#seed]
Use sha1 hash of given file as a (not so) random generator
-C
Print the generated passwords in columns
-1
Don't print the generated passwords in columns
-v or --no-vowels
Do not use any vowels so as to avoid accidental nasty words
Examples
Generate one single password.
$ pwgen -c -n -y 100 1
9S3UKhXUmoFMl7Nfm2E093EFTWVyX2d711AEKuOnCqWnkAQIJyPjgd3pgITmvove9wx0MbqLAnl8t8EsgMARigM5rSHFLDeopEuD
This password uses
- at least 1 capital letter
- at least 1 number
- at least 1 symbol
- 100 characters
- 1 total password
Tell Pwgen to give 10 passwords.
$ pwgen -c -n -y -s 100 10
8Jjnm7RDTmMbMVs1gJotHo0esHR0GAJPaDErSjqyWZmdMJxh4xe5uiScHu4LfK8AbCj5lH5Iyu7P9Ia9nJyNZENJqmqruzQVIcO9
QatpFsxT7uHCWdEO5d0x7oKX1SKzv9w1gJkrYd8lXcaJyoZr1BCMe2xuaWbyy7Zidf9ueCZOv3oAFO0aWhTRT0T44o9OLdtPOWR3
9Zm70DICfcvfHPTsyz83VuLJ1MyUSHJE9kkuXDltGorouwaXsHuRfdvJDXg40XmPSOTC6K4omfinqGefU6oQ7pj4sOCnplhiMxAD
bi8DOCfMmDmTQ3EL8RXDgInEUqV0mTk0ZeUXDstiEm2pj3PQ6kjSRcVawQw0jIuuaq4ZQGsyNzIBnNJJVkT42hgPLtJD9WaxIICE
DfdQiPEwPytSHBD5vDqgqxxbBuqlNFbADRvljtfTUAf2eCheuGLsLBUJGvs4YZ3MUglrY3ebKLQBQ20aEJu0RAeC0M1mjdNNJp3z
ZnL0oJSh45a2yAVvaS4HM2GTuUWgitX5pGRjF2LjXnmsp2kRvQYrxkQxo2yqWmJ6Lqh6uaDmckQhlcujoJvZgRruSbUZxZniLjNi
UaeFRz4rcMfVtarft7J5Lspu2tamL9i9fu9J394exCfRDj2k6UN5HsCi7shWy8bD2IB1ISAGyIb8qIpXvygQuzQJaZ9V5dYaCRaj
NLRZSsmtDCA2sVtjIse8brhMM0GWskJffOvarAYBZEagz179AdwtgnmpaRz2sZo3Yw36RO15Nls9QbJrvWQbKek0ULq4dNMaNK1N
1TOvS5zuKB1LC9PaewvOO8jEn8lij1KYJyvvfLIgbLP8zlo4vzf2uOcJmkXa9ukpXxxcTuoYRNpscwbfx8HiSDWLJQ4jNjxUICz6
AwmHShhV8WQGjvOwyM8mTIjex6APatAVEGHcACCji53ClfnPKsiO7cacdQK5zTSxdLIqe4bwqWImlQJYMY0P4Uj6PckdfMWRptWX
I think anyone should get the idea right away. In short, you can easily fine tune Pwgen to give as complex of passwords as needed.