forked from serverok/squid-proxy-installer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsquid-add-user.sh
32 lines (26 loc) · 880 Bytes
/
squid-add-user.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/bin/bash
############################################################
# Squid Proxy Installer
# Author: Yujin Boby
# Email: [email protected]
# 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