Home > Documentation > Squid Proxy Server > Adding username and password access control on a Squid Proxy Server.

Adding username and password access control on a Squid Proxy Server.

Posted by peter on October 12, 2011

Add access control by password by following the following steps:

Create the password file. The name of the password file could be /etc/squid/squid_passwd, and you need to make sure that it's universally readable. To do this type the following at the command prompt:

 touch /etc/squid/squid_passwd

chmod o+r /etc/squid/squid_passwd

 

Use the “htpasswd2” program to add users to the password file. You can add users at anytime without having to restart Squid. For example, create a user called “fred”. To do this, type the following at the command prompt

htpasswd /etc/squid/squid_passwd fred

 You will then be asked to confirm the password

Next you need to find the location of your “ncsa_auth” file using the rpm command. Type the following at the command prompt:

 rpm -ql squid | grep ncsa

Take note of the path to that file

Now edit “squid.conf” to define the authentication program in squid.conf add the following line to the “Auth” section of the file. Make sure the path to the ncsa is the same as seen above.

 auth_param basic program /usr/lib64/squid/ncsa_auth /etc/squid/squid_passwd

 Now add the following to the bottom of the “ACL” section of the “squid.conf” file.

 acl ncsa_users proxy_auth REQUIRED

 Then add the following to the top of the “http_access” section of the “squid.conf” file.

http_access allow ncsa_users

 Set squid to run at boot by typing the following command:

chkconfig squid on

Comments:

Leave a Reply



(Your email will not be publicly displayed.)

Please type the letters and numbers shown in the image.Captcha CodeClick the image to see another captcha.