Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. 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

Suppose for the sake of argument my password below is abc123@

I need to authenticate my linux machine through a corporate proxy to get patches and updates... normally I'd use this:

export HTTP_PROXY='http://<Americas\Username>:<Password>@proxy.foo.com'
export http_proxy='http://<Americas\Username>:<Password>@proxy.foo.com'

However, when I substitute a real password ending with @ and then run aptitude update, I get...

[mpenning@netwiki ~]$ sudo -E aptitude update
Err http://mirror.anl.gov squeeze Release.gpg
  Could not resolve '@proxy.foo.com'
Err http://mirror.anl.gov/debian/ squeeze/main Translation-en
  Could not resolve '@proxy.foo.com'

I have tried escaping the password with \@, escaping both with \@\@, double characters (@@), and nothing seems to get this to proxy correctly; I never had a problem until I changed my password recently.

What is the right way to escape my password in bash?

share|improve this question
up vote 10 down vote accepted

You could try URL-encoding your password. @ should be replaced by %40.

Tackling Special Characters in Proxy Passwords on Linux indicates this should work, but looking around other people seem not to get that to work (and I have no way of testing this).

share|improve this answer
Just to save you time : meyerweb.com/eric/tools/dencoder. Thanks for the tip @Mat – Jean-Rémy Revy Sep 10 '14 at 16:05

please use %40 in place of @ in your password,

for Example:

your password is " A@ple123 " then use " A%40ple123"

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.