If I want to have GNOME applications (as well as Firefox and Chrome) access the network through a proxy, I need only use gnome-network-properties (a nice and simple GUI I must say). For other apps (e.g. APT, Transmission, XChat), I have to use their specific ways of doing it.

Is there a way to avoid this, something I can turn on and off when in a network that requires a proxy (hostname:port)?

  • 1
    I think that the http_proxy variable is what you're looking for. Take a look in the Proxy Support howto. – sakisk Mar 18 '11 at 8:28

I think pretty much all linux/unix software that uses networking will honor the http_proxy and ftp_proxy environment variables. Depending on how your distribution is set up, /etc/environment will exist and be read by default by login shells.

You can add a line saying


in /etc/environment easily enough, but changes in that file will only take hold the next time you start a shell process -- and only in that shell process. I don't think you can modify global variables in a shell other than your current one.


I agree that the best way to use the proxy server is with the environment variable http_proxy, as other answers have pointed out. Unfortunately, not all applications honour the http_proxy environment variable, which is why I still use tsocks for some programs to use LD_PRELOAD to force network connections to go through a SOCKS proxy.


Besides tsocks — which still AFAICT requires you to launch programs with the correct environment to work — you should check out tun2socks. With it you set up a TUN interface (i.e. a new network interface, just like a VPN would create) and any packets sent there get proxied to your SOCKS5 server. You then set up your system routes to actually send the traffic to this. Seems like a nice approach.

(I also found redsocks via this post. This doesn't seem as elegant as using a TUN interface to me — e.g. it doesn't really handle UDP at all, for starters.)


I use this tool, which is basically a couple of scripts to configure settings for different applications from single point.

PS: I wrote and maintain that tool.


There's no one-for-all solution. Each program uses its own way to connect to a proxy server.

I have a similar problem at my office. I found that best way to do this is to use a VPN connection. When you connect, the whole system network traffic will go through the VPN. If you don't have access to a VPN server, you can run a new one manually, and connect it to the proxy server you've got.

If you have an application that doesn't support proxy, you can use something like socksify, to wrap its network connection.

  • So you've tried this and failed? – Tshepang Mar 18 '11 at 11:02

I have a similar issue, but for me to accomplish a system wide proxy will be addressing Linux's kernel iptables. Adding and removing forwarding rules in the iptables (specific addresses,ports & protocols), acting on the network layer is the only way to ensure a system wide proxy, that can't be overridden by any app-specific settings in the application layer.


This worked for me
vi /etc/environment:


vi /etc/yum.conf:


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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