Linux – Applying proxy settings system-wide on Linux


Our campus employs proxy server with authentication.

So, I have to apply http://username:password@proxyIp:port/ bash configure file(suppose for wget or curl) or manually entering details for every graphical application (like gtalk), and also if I work with localhost (XAMPP),

I have to configure XAMPP, and so on. If I have my proxy password changed I have to change it everywhere on the system!
Is there a way I can apply proxy settings system-wide at one place.Even though I am asking for Linux, I would like to know it on windows also.

Best Answer

There is no such thing as global proxy configuration on Linux. Some applications may respect the http_proxy environment variable, depending on the network/HTTP library they use, others will not.


On Linux – contrary to for example Windows – there are a range of libraries that initiate HTTP connections like cURL, etc. To the operating system (the kernel) only sees a bunch of TCP connections going to all over the world. On Windows most applications rely on the HTTP library that came with Internet Explorer and the rest adapted to take advantage of those settings too.

The Linux world has never "evolved" a central place to configure proxy servers, so there simply is no way to enforce the usage of a specific proxy server short of redirecting all network traffic in the firewall.

Practical advice

You may achieve the best result setting the http_proxy variable as early in the process tree as possible. Depending on your Linux distribution you will have to look up the specific place to put that variable into. On Ubuntu that would for example be /etc/environment.

Related Question