Configure Squid Authentication Password
Before configuring authentication user and password 1st configure SQUID and check whether it is working fine without any authentications [Click here to check Installation steps of Squid/Proxy]
You can configure Squid to prompt users for a username and password. Squid comes with a program called ncsa_auth that reads any NCSA-compliant encrypted password file. You can use the htpasswd program that comes installed with Apache to create your passwords [Click here to check Installation steps of APACHE/WEBSERVER]
Create squid_passwd file on /etc/squid/ directory and you need to make sure that it's universally readable.
[root@sandeeplinux-server squid]# touch squid_passwd
[root@sandeeplinux-server squid]# chmod o+r squid_passwd
Use the htpasswd command to add users to the password file. You can add users at anytime without having to restart Squid. Example: User Name = sandeep with sandeep123 password
[root@sandeeplinux-server squid]# htpasswd /etc/squid/squid_passwd sandeep
New password:
Re-type new password:
Adding password for user sandeep
[root@sandeeplinux-server squid]#
Find your ncsa_auth file using the locate command.
[root@sandeeplinux-server squid]# locate ncsa_auth
/usr/lib/squid/ncsa_auth
/usr/share/man/man8/ncsa_auth.8.gz
[root@sandeeplinux-server squid]#
Enter or un-comment bellow lines in /etc/squid/squid.conf file
[root@sandeeplinux-server squid]# vi squid.conf
auth_param basic program /usr/lib/squid/ncsa_auth /etc/squid/squid_passwd
(Add or un-comment above line in auth_param Session)
acl ncsa_users proxy_auth REQUIRED
http_access allow ncsa_users
(Add above line in ACL Session)
Save & Exit:
Restart Squid Server
[root@sandeeplinux-server squid]# service squid restart
Stopping squid: ................ [ OK ]
Starting squid: . [ OK ]
[root@sandeeplinux-server squid]#
Now Open Browser on client machine (Windows/Linux Client) It will ask for User name and Password, Give above created user name and password, Now you can access Internet...
Thanks and Regards,
Sandeep CC