Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

apt-get behind proxy. Special characters in username and password

I would like to set apt-get to use a proxy on my ubuntu box. I have successfully configured synaptic to use a proxy, so I can install packages, but I would like to be able to use the command line.

My work proxy requires both a username and password, both of which have special characters in them.

In my .bashrc I have

export http_proxy="http://user@company:P@[email protected]:80/"

however, this doesn't work.

I've also tried escaping the special characters but that doesn't seem to work either:

export http_proxy="http://user\@company:P\@\$\[email protected]:80/"
like image 758
LeviX Avatar asked Feb 14 '12 18:02

LeviX


1 Answers

Seemed to be a combination of 2 things. I needed to use escape codes for the special characters and I needed to add entries to /etc/apt/apt.conf. (Supposedly, exporting the _proxy environment variables should make apt-get work, but I did not have that luck.)

/etc/apt/apt.conf:

APT::Get::AllowUnauthenticated 1;
Acquire::http::proxy "http://user%40company:P%40%24%[email protected]:80/";
Acquire::ftp::proxy "ftp://user%40company:P%40%24%[email protected]:80/";
Acquire::https::proxy "https://user%40company:P%40%24%[email protected]:80/";

.bashrc:

export http_proxy="http://user%40company:P%40%24%[email protected]:80/";
export ftp_proxy="ftp://user%40company:P%40%24%[email protected]:80/";
export https_proxy="https://user%40company:P%40%24%[email protected]:80/";
like image 67
LeviX Avatar answered Sep 22 '22 13:09

LeviX