Sign up ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I have a really simple Q. I just need to know how to specify an http proxy (with login credentials) within debian. The squid server is a separate machine, and since the proxy got implemented our web services and backups on the dev server arn't working. so basically i just need to specify an http proxy within debian...

share|improve this question

4 Answers 4

Transparent proxying CANNOT be done with login credentials. Think about it; if the user doesn't know it's going on, then you can't expect them to engage in a username/password exchange!

share|improve this answer

Transparent http traffic routing

# Your debian machine (gateway)

# Your network

# Your squid machine

iptables -t mangle -A PREROUTING -s $LAN_IP_RANGE ! -d $LAN_IP_RANGE -p TCP --destination-port 80 -j MARK --set-mark 11                                     
iptables -t nat -A PREROUTING -m mark --mark 11 -p TCP -j DNAT --to-destination ${PROXY_IP}:${PROXY_PORT}                                                          
iptables -t nat -A POSTROUTING -m mark --mark 11 -p TCP -j SNAT --to-source $LAN_IP
share|improve this answer

You may want to can create an environnement variable 'http_proxy' throught your .bashrc script and assign it the value like:

export http_proxy=

There's also manual settings to to with the web browser but for apt-get edit your /etc/apt/apt.conf and add:

use Acquire::http::Proxy "";

EDIT: You may wish to look at the following article to setup iptables tor edirect the traffic to your proxy:

share|improve this answer
what if nobody logs in? I need it to be as transparent as possible, this is our web dev server, most users don't login they just access shares via samba.. – Bananagram Jul 7 '09 at 7:01
I suspect i need to use iptables? – Bananagram Jul 7 '09 at 7:02
http_port transparent, add this in squid.conf – Caterpillar Jul 7 '09 at 7:08

Hi This may help you. Try this.

Add this in /etc/squid.conf

auth_param basic program /usr/lib/squid/getpwnam_auth /etc/passwd auth_param basic children 5 auth_param basic realm Squid Proxy Cacheing Server auth_param basic creddentialsttl 1 hour

I have also been advised to enter the acl:

acl password proxy_auth REQUIRED http_access allow password

One site has stated that you need the entry:

authentication_program /usr/lib/squid/getpwnam_auth

share|improve this answer

Your Answer


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