excludechars=\`
htpasswd -bnBC 10 "" $(pwgen -sncBy -r "$excludechars" 16 1 | tee /dev/tty | tr -d '\n') | tr -d ':'
htpasswd -bnBC 10 ""
-b
use password from command line-n
send to stdout-B
use bcrypt-C 10
bcrypt computing cost""
username, not used
pwgen -sncBy -r "$excludechars" 16 1
-s
secure-n
at least 1 number-c
at least one capital letter-B
avoid ambiguius chars like lI-y
include one symbol-r "$excludechars"
exclude chars16
pw size1
generate one
| tee /dev/tty
- to print the password and pass along
| tr -d '\n'
to remove new line thatpwgen
adds| tr -d ':'
to remove:
thathtpasswd
adds