How to: Linux / UNIX setup Squid Proxy authentication

www.lautt‮.iru‬com
How to: Linux / UNIX setup Squid Proxy authentication

To set up Squid proxy authentication on a Linux or Unix system, follow these steps:

  1. Install the Squid package on your system. On most Linux distributions, you can use the apt, yum, or dnf package manager to install Squid. For example:
# apt-get install squid
  1. Edit the Squid configuration file, usually located at /etc/squid/squid.conf, to enable authentication. Add the following lines to the configuration file:
auth_param basic program /usr/lib/squid/basic_ncsa_auth /etc/squid/passwd
auth_param basic children 5
auth_param basic realm Squid proxy-caching web server
auth_param basic credentialsttl 2 hours
acl authenticated proxy_auth REQUIRED
http_access allow authenticated

This will enable basic authentication using the NCSA (Netware Common Server Agent) authentication module and the /etc/squid/passwd password file. The acl line defines an access control list (ACL) that allows access to authenticated users, and the http_access line grants access to users that match the authenticated ACL.

  1. Create the password file by running the htpasswd command. This will create a new password file or add a new user to an existing password file. For example:
# htpasswd -c /etc/squid/passwd user1

This will create a new password file named /etc/squid/passwd and add a user named user1 to the file.

  1. Restart the Squid service to apply the changes. On most systems, you can use the systemctl command to restart the Squid service. For example:
# systemctl restart squid

This will restart the Squid service and apply the changes you made to the configuration file.

  1. Test the authentication by trying to access the Squid proxy from a web browser. You should be prompted for a username and password. Use the username and password that you created in the password file to authenticate.

It's important to note that this is just one example of how to set up Squid proxy authentication on a Linux or Unix system. The specific steps may vary depending on your system and the version of Squid that you are using. Consult the Squid documentation and online resources for more information on how to set up and configure Squid proxy authentication.

Created Time:2017-10-29 22:08:41  Author:lautturi