export HTTP_PROXY and special characters in passwd
Solution 1
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).
Solution 2
Even more simple and Reliable!
General Syntax:
sudo {http,https,ftp}_proxy=http://<username>:<password>@<proxy_url/_proxyip>:<port>/ wget --timeout=5 --no-check-certificate http://<website_url>
Example:
[root@localhost ~]# sudo {http,https,ftp}_proxy=http://username:[email protected]:6050/ wget --timeout=5 --no-check-certificate http://google.com
{http,https,ftp}_proxy -> http, https, ftp urls. Seperated by comma.
--timeout=5 -> Connection to keep alive in seconds.
-no-check-certificate -> Ignore SSL / Certificate Verification.
--spider -> If you want to test the connectivity without downloading the file.
Notes:
Online Converter:
Replace special characters with its equivalent hexadecimal unicode. For a list of unicodes refer the website https://unicode-table.com (or) http://unicodelookup.com
Local Converter using Python:
Reference: conversion of password "p@s#w:E" to unicode will be as follows,
@ = %40
$ = %24
# = %23
: = %3A
p@s#w:E = p%40s%23w%3AE
Input:
[root@localhost ~]# python -c "import sys, urllib as enc; print enc.quote_plus(sys.argv[1])" "p@s#w:E"
Output:
p%40s%23w%3AE
Related videos on Youtube
![Mike Pennington](https://i.stack.imgur.com/BPTe1.jpg?s=256&g=1)
Mike Pennington
Updated on September 18, 2022Comments
-
Mike Pennington almost 2 years
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 runaptitude 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
? -
Jean-Rémy Revy almost 10 yearsJust to save you time : meyerweb.com/eric/tools/dencoder. Thanks for the tip @Mat