Add pwgen
Jes Olson jolson@digitalocean.com
Thu, 06 Jan 2022 17:28:28 -0600
1 files changed,
11 insertions(+),
0 deletions(-)
jump to
A
bin/pwgen
@@ -0,0 +1,11 @@
+#!/bin/sh +# +# generate a password of N length + +pass_length="$1" + +# Regarding usage of '/dev/urandom' instead of '/dev/random'. +# See: https://www.2uo.de/myths-about-urandom +pass=$(LC_ALL=C tr -dc "_A-Z-a-z-0-9" 2> /dev/null < /dev/urandom | + dd ibs=1 obs=1 count="${pass_length:-50}" 2>/dev/null) +printf "$pass\n"