Created
August 21, 2018 13:34
-
-
Save bohack/d05bd77a356994d1d8d71ff301bc8434 to your computer and use it in GitHub Desktop.
PacketFence Code Generator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Bohack | |
# 04/26/16 | |
# Script to generate password for htpasswd file | |
if [ -z "$1" ] | |
then | |
echo | |
echo "$0 [user to generate passwd for]" | |
echo | |
exit 1 | |
fi | |
GENUSR=$1 | |
GENUUSR=${GENUSR^} | |
PASSWD=`cat /dev/urandom | tr -dc 'a-z0-9' | fold -w 6 | head -n 1` | |
echo "$PASSWD" > /usr/local/pf/html/accesscode/${GENUSR}cod | |
htpasswd -b /usr/local/pf/html/accesscode/codpasswd $GENUSR $PASSWD | |
htpasswd -b /usr/local/pf/html/accesscode/codpasswd $GENUUSR $PASSWD | |
htpasswd -b /usr/local/pf/html/accesscode/codpasswd stem stem | |
htpasswd -b /usr/local/pf/html/accesscode/codpasswd Stem stem | |
htpasswd -b /usr/local/pf/html/accesscode/codpasswd STEM STEM | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment