Ubuntu: I can't use HTTP Proxy in the shell


I am a Linux Ubuntu user and I have some problem setting the proxy on my entire system.

I go into the network settings of my Gnome and then I go to the Network Proxy settings mask and then I put my proxy for the HTTP Proxy* as Manual, then I click on the Applies to the entire system button, it ask me my password and it is finish

The problem is that if I open a shell, the network don't work and I can't ping anyting, infact I obtain only:

andrea@andrea-Studio-1555:~$ ping google.com  PING google.com ( 56(84) bytes of data.  

and the cursor still blink and don't go on...

Why? What can I do to go out with my proxy in the shell?


Set http_proxy shell variable

Type the following command to set proxy server:

$ export http_proxy=http://server-ip:port/  $ export http_proxy=  $ export http_proxy=http://proxy-server.mycorp.com:3128/  

How do I setup proxy variable for all users?

To setup the proxy environment variable as a global variable, open /etc/profile file:

# vi /etc/profile  

Add the following information:

export http_proxy=http://proxy-server.mycorp.com:3128/  

Save and close the file.

How do I use password protected proxy server?

You can simply use wget as follows:

$ wget --proxy-user=USERNAME --proxy-password=PASSWORD http://path.to.domain.com/some.html  

Lynx has following syntax:

$ lynx -pauth=USER:PASSWORD http://domain.com/path/html.file  

Curl has following syntax:

$ curl --proxy-user user:password http://url.com/  

try this information it may help you.


Try reading up about using a proxy in combination with Ubuntu here.

That you cannot ping is to be expected. A proxy server is for relaying (and caching) HTTP, HTTPS, FTP protocols. Each has to be configured separately. When you ping, it is utilizing the ICMP protocol. Most proxy servers don't allow this. Also, most proxy servers do the DNS resolving for you (translating the www.google.com to an IP address); the reason why you don't get anything else but that first line is because you cannot resolve the domain.

Follow the guide I gave in the beginning and try again.

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »