15

I want to update ubuntu 11.04 throught apt-get. So I added the following lines in apt.conf

export http_proxy=http://username:[email protected]:port/
export ftp_proxy=http://username:[email protected]/

export http_proxy=http://deepak:Deepak@[email protected]:3128

My question is: how do I insert special characters to a username or password?

For instance: my password for proxy is Deepak@123 and it is getting an error.

Rinzwind
  • 293,910
  • 41
  • 570
  • 710
Deepak Rajput
  • 6,887
  • 9
  • 29
  • 37
  • 6
    Er... is that *really* your password? – Nathan Osman Oct 18 '11 at 05:10
  • You can export proxy settings in `.bashrc`. In `apt.conf` you have to use [this](http://askubuntu.com/questions/34666/what-happened-to-etc-apt-apt-conf/43218#43218) – Nemo Oct 18 '11 at 05:16

4 Answers4

25

You need to escape special characters. So place a \ in front of the @ like so:

export http_proxy=http://deepak:Deepak\@[email protected]:3128

Alernatively you can also use %40.

Rinzwind
  • 293,910
  • 41
  • 570
  • 710
4

Click on

  1. Dash home
  2. Search for System Settings
  3. Select Network
  4. Select Network Proxy
  5. Select Manual method
  6. Set you proxy and port

Kudos You are Done if you set right

Peachy
  • 7,077
  • 10
  • 37
  • 45
titus
  • 41
  • 1
4

If your password or username contains @ you can percent-encode (also referred as URL encoding) it as %40 in the proxy url. For more special characters see here

AjayKumarBasuthkar
  • 1,042
  • 9
  • 11
Henok T
  • 141
  • 1
0

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
M.S.Arun
  • 201
  • 3
  • 5