scripts

random scripts
git clone https://git.parazyd.org/scripts
Log | Files | Refs

genhtpasswd (333B)


      1 #!/bin/sh
      2 #
      3 # parazyd - (c) wtfpl 2016
      4 # generate htpasswd entries
      5 
      6 user="$1"
      7 realm="$2"
      8 password="$3"
      9 
     10 if [ -z $user ] || [ -z $realm ] || [ -z $password ]; then
     11 	echo "usage: `basename $0` [user] [realm] [password]"
     12 else
     13 	echo -n "${user}:${realm}:" \
     14 		&& echo -n "${user}:${realm}:${password}" \
     15 		| md5sum | awk '{print $1}'
     16 fi