Quick and dirty password generator

Using commonly installed tools to generate date-based 32-character base-64 (alpha-numeric and plus/minus) passwords:

date +%s | sha256sum | base64 | head -c 32 ; echo

pwgen is sometimes installed. It aims to generate easy to remember passwords. Its usage and key arguments are:

pwgen [ OPTION ] [ pw_length ] [ num_pw ]

  • -s, --secure - Generate completely random, hard-to-memorize passwords. These should only be used for machine passwords, since otherwise it’s almost guaranteed that users will simply write the password on a piece of paper taped to the monitor…
  • -c, --capitalize - Include at least one capital letter in the password. This is the default if the standard output is a tty device.
  • -n, --numerals - Include at least one number in the password. This is the default if the standard output is a tty device.
  • -y, --symbols - Include at least one special character in the password.

These arguments reduce the complexity (and therefore security) of the generated passwords;

  • -A, --no-capitalize - Don’t include capital letters in the password.
  • -0, --no-numerals - Don’t include numbers in the password.
  • -B, --ambiguous - Don’t include ambiguous characters inthe password (e.g. 1, I, l)
  • -r, --remove-chars=chars - Remove characters chars from teh set of characters used to generate passwords.
# Generate 32 character passwords with symbols
pwgen -y 32