HEX
Server: nginx/1.29.3
System: Linux 11979.bigscoots-wpo.com 6.8.0-88-generic #89-Ubuntu SMP PREEMPT_DYNAMIC Sat Oct 11 01:02:46 UTC 2025 x86_64
User: nginx (1068)
PHP: 7.4.33
Disabled: exec,system,passthru,shell_exec,proc_open,proc_close,popen,show_source,cmd# Do not modify this line # 1684243876
Upload Files
File: //usr/local/nginx/conf/htpasswd.sh
#!/bin/bash
######################################################
# written by George Liu (eva2000) centminmod.com
######################################################
# Create at /usr/local/nginx/conf/htpasswd
# ./htpasswd.sh create /usr/local/nginx/conf/htpasswd user1 pass1  
######################################################
# Append at /usr/local/nginx/conf/htpasswd
# ./htpasswd.sh append /usr/local/nginx/conf/htpasswd user2 pass2 
######################################################
# variables
#############
DT=$(date +"%d%m%y-%H%M%S")

######################################################
# functions
#############

genpassa() {
  if [[ -f "$file" && "$user" && "$pass" ]]; then
  printf "${user}:$(openssl passwd -apr1 ${pass})\n" >> $file
  echo ""
  echo "$file contents:"
  cat $file
  fi
}

genpassc() {
  if [[ -f "$file" && "$user" && "$pass" ]]; then
  printf "${user}:$(openssl passwd -apr1 ${pass})\n" > $file
  echo ""
  echo "$file contents:"
  cat $file
  fi
}

######################################################
file=$2
user=$3
pass=$4

case "$1" in
  create)
    touch $file
    genpassc
    ;;
  append)
    genpassa
    ;;
  *)
    echo ""
    echo "$0 {create|append} /usr/local/nginx/conf/htpasswd user1 pass1"
    ;;
esac