Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have a problem with wget and I've discover that my proxy settings is wrong:

$ env | grep "proxy"
http_proxy=http://213.181.73.145:80
https_proxy=http://213.181.73.145:80

So, when I try to download something with wget, it fails trying to connect to the proxy, and not trying to connect to the web resource that I need to download.

But in superuser mode all is correct:

$ sudo su
$ env | grep "proxy"
$

(empty output, no proxy)

I want to know where this variables are settings, and I found a lots of problems. I added the next line to the beginning of my /etc/profile:

env | grep "proxy"
echo "Hello"

And for me surprise, both variables are settings with that same values before any configuration file is loaded (/etc/bashrc, ~/.bashrc, etc):

(new terminal)
http_proxy=http://213.181.73.145:80
https_proxy=http://213.181.73.145:80
Hello
$

Moreover, I work with guake. So, I tried the same with a common terminal, and for me surprise, (I think) the file /etc/profile isn't loaded, since I don't see nor the proxy lines but neither the echo "Hello" message.

So, I would like to know how is possible that http_proxy and https_proxy are defined before loading /etc/profile and why I don't see the "Hello" message when I open a common terminal.

share|improve this question
add comment

2 Answers

The message is not displayed when you open a "normal" terminal because /etc/profile is only read for login shells, a "normal" terminal starts an interactive, non-login shell. See my answer here for more information.

Now, I don't know where your http_proxy is set. Depending on what exactly your setup is, it could be in various places. Try this:

grep http_proxy /etc/bash.bashrc /etc/profile ~/.bashrc ~/.bash_login ~/.profile ~/bash_profile

The variable should be set in one of those files.

share|improve this answer
add comment

Some file that is run on shell startup is setting the environment variables, such as ~/.bashrc , ~/.bash_profile, or /etc/bash.bashrc

You don't have to change any file to take off the proxy variable, though! All you have to do is use the 'unset' command!

$ unset http_proxy
$ unset https_proxy

Now those environment variables are gone! If you can't track down where they are set, you can add that to the end of your ~/.bashrc, and unset them for every shell. If you test it out again:

$ env | grep proxy
[nothing]

You'll see they've gone!

share|improve this answer
    
But, the key of the question is that this variable is set before any configuration file is loaded. The question is where can a variable be setted before /etc/profile. –  Peregring-lk Apr 15 '13 at 7:21
add comment

Your Answer

 
discard

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.