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

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

What is the correct format using special characters in http_proxy environment variable?
Or to be mor specific, what to do with special characters in username or password when authenticate to http proxy on the command line.

share|improve this question
What do you mean by "special characters"? – John Gardeniers Feb 15 '13 at 12:39
up vote 1 down vote accepted

At first, the complete format is:


Every special character in username and password must not conflict with the characters used in the above format AND must be URL compliant.

Here is an example:

User:   my@email.address  
PW:     a%b(c/x@y z
Port:   8080



And to prevent bash interpretation of any character always use single-quotes.

You can set this system wide in /etc/environment like this:


Easy URL encoding/decoding:

share|improve this answer

Suppose your username is foo and your password is bar$.

Quote them:

http_proxy='http://foo:bar$@localhost:3128/' wget

Or escape them:

http_proxy=http://foo:bar\$@localhost:3128/ wget

What if your password is bar/? URL encode them.

http_proxy="http://foo:bar%2F@localhost:3128/" wget
share|improve this answer

Your Answer


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.