Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have two kinds of users accessing squid. I want the first group can access always internet, the second should only be allowed to access internet at certain times.

I have users on the same file (created with htpasswd).

How can achieve this?

Thanks in advance,

share|improve this question
up vote 1 down vote accepted

First of all you have to set up authentication

Add the following to the authentication section of your squid.conf

auth_param basic program /usr/lib/squid/ncsa_auth /usr/local/etc/squid/passwd
auth_param basic children 5
auth_param basic realm Squid proxy-caching web server
auth_param basic credentialsttl 8 hours

You will want to change the path to the password file to match your password file location. You may want to change the credentialsttl if you want people to authenticate more frequently.

In the a ACL section of your squid.conf add the following

acl allowed_anytime proxy_auth "/usr/local/etc/squid/allowed_anytime"
acl allowed_by_time proxy_auth "/usr/local/etc/squid/allowed_by_time"

acl allow_hours time SMTWHFA 09:00-17:00

http_access allow  allowed_anytime

http_access allow allowed_by_time allow_hours

http_access deny all

You may want to create your allowed_anytime and allowed_by_time elsewhere so change the paths above.

The file allowed_anytime should contain a list of users who can use the internet all the time e.g.


The file allowed_by_time should contain a list of users who can use the internet during the time specified by the allow_hours acl e.g.

share|improve this answer
Thanks, it helped a lot! – Ramon Araujo Feb 28 '11 at 23:36

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.