407 Proxy Authentication Required

When I try to install a software using Ubuntu Software center I get:

Failed to download repository information
Check Your Internet connection

When I try to do a apt-get install something, I get:

407  Proxy Authentication Required

I use a proxy server that requires a user-name and a password. I have set my systems proxy manually, by plugging in the required numbers in the Networks proxy and applied it system wide. I guess the problem now is plugging in my user-name and password.

When I use INTERNET via Mozilla, it specifically asks me for my user-name and password.


Solution 1:

For your apt-get to work, you should edit your apt config file:

sudo -H gedit /etc/apt/apt.conf

And add Acquire::http::Proxy "http://username:password@proxyhost:port/";

The syntax shown above should be strictly followed.

This configuration may fail if your username or password has an '@' in it. You can also add proxy configuration for other protocols such as FTP.

Update: If your username or password has '@' in it you can replace it with %40 Example:If your password is @123 enter it as %40123.

For other characters see this Percent-encoding

Solution 2:

First set your proxy setting via Linux wizard use option manually and apply setting systemwide just like this wizard box.

Add your proxy environment. These are just example settings...
Open your command prompt login and edit the apt.conf file:

sudo vi /etc/apt/apt.conf

There are already 4 lines of code starting with Acquire key word, edit it like this:

Acquire::http::Proxy "http://username:password@proxyhost:port/";
Acquire::https::Proxy "https://username:password@proxyhost:port/";
Acquire::ftp::Proxy "ftp://username:password@proxyhost:port/";

Note
If your Password contains special characters like @,$,! (e.g. Password: P@ssword) then replace the special characters by their hex code equivalents with % prefix like this:

Acquire::http::Proxy "http://username:p%40ssword@proxyhost:port/"; 

@==>%40
$==>%24
!==>%21

Solution 3:

If you're behind an enterprise proxy that's running NTLM authentication, you could use CNTLM:

$ sudo apt-get install cntlm
$ sudo vi /etc/cntlm.conf

Change the default settings (domain, username, password and proxy). Then restart the service:

$ sudo /etc/init.d/cntlm restart

You can now use localhost:3128 (default CNTLM port) as the system-wide proxy for Ubuntu.

Check http://cntlm.sourceforge.net/ for docs.

Solution 4:

If your user name is separated by space then use:

export http_proxy='http://Pankaj Kumar Pandit:[email protected]:3128/'

If your user name is not separated by space then use:

export http_proxy=http://Pankaj_Kumar_Pandit:[email protected]:3128/

The difference is the addition of opening and closing '.

Solution 5:

I think this tutorial should help you.

Click on Network tab select Manual Proxy Configuration option and enter your proxy server,port details.If you have username,password click on Authentication to enter these details click on ok

(from http://www.ubuntugeek.com/how-to-configure-ubuntu-desktop-to-use-your-proxy-server.html)

To invoke it for all programs launched in a shell I would suggest you either add it to your /etc/bash.bashrc using gksudo gedit /etc/bash.bashrc to apply it system-wide for all bash sessions or to your user-space ~/.bashrc.

As far as Synaptic goes, in the Preferences under the Network tab you seem to be able to set authentification for your proxies. This appears to be specific to Synaptic, though.