Skip to content

Commit

Permalink
added generate-pwd.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
br-cpvc committed Jun 16, 2022
1 parent 6987301 commit 4dcebeb
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions generate-pwd.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash

#from: https://www.redlever-solutions.com/blog/howto-generate-secure-passwords-with-openssl

LENGTH=25
if [ ! -z "$1" ] && [ $1 -gt 1 ]; then
LENGTH=$1
fi
NUMBYTES=`echo $LENGTH | awk '{print int($1*1.16)+1}'`

openssl rand -base64 $NUMBYTES | tr -d "=+/" | cut -c1-$LENGTH

0 comments on commit 4dcebeb

Please sign in to comment.