Thursday, May 2, 2024

Generate Tough Passwords From the Commandline

Note: Requires openssl
Usage: $> genpasswd [int size, default: 8]
alias genpasswd='_(){ if (($#<1)); then PASSWDSIZE=8; else PASSWDSIZE=${1};fi; openssl rand -base64 32|sed -r "s/^(.{${PASSWDSIZE}})(.*)/\1/g"; }; _'