Files
squid-proxy-installer/squid-add-user.sh
2023-07-16 03:02:55 +05:30

33 lines
880 B
Bash

#!/bin/bash
############################################################
# Squid Proxy Installer
# Author: Yujin Boby
# Email: admin@serverOk.in
# Github: https://github.com/serverok/squid-proxy-installer/
# Web: https://serverok.in/squid
# If you need professional assistance, reach out to
# https://serverok.in/contact
############################################################
if [ `whoami` != root ]; then
echo "ERROR: You need to run the script as user root or add sudo before command."
exit 1
fi
if [ ! -f /usr/bin/htpasswd ]; then
echo "htpasswd not found"
exit 1
fi
read -e -p "Enter Proxy username: " proxy_username
if [ -f /etc/squid/passwd ]; then
/usr/bin/htpasswd /etc/squid/passwd $proxy_username
else
/usr/bin/htpasswd -c /etc/squid/passwd $proxy_username
fi
systemctl reload squid > /dev/null 2>&1
service squid3 restart > /dev/null 2>&1