Our server is on a corporate network, which requires corporate proxy authentication (e.g. enter corporate username and password). This is not an issue on the Windows machines on that network - when a web browser is opened the user is prompted to authenticate. However, when using a browser on Linux, the user is not prompted to authenticate, the browser simply shows a message saying authentication is required.

Internet Access would be useful

At the moment I have to walk to my desk on another floor, if I need to look something up, because I cannot get Internet access from this machine, since I cannot (or do not know how to) authenticate. It would be useful to have the ability to authenticate, so I can use a web browser.

Packages cannot be updated

When I attempt to perform updates using sudo apt-get update or sudo apt-get install [package], there are errors, which I believe are caused due to lack of authentication.

After performing sudo apt-get update, I get errors like W: Failed to fetch [link] 401 Authorization Required. (For some reason some http://us.archive.ubuntu.com trusty/ sources work correctly, and some throw the same error).

This is a major problem, as I need to be able to update packages on the server.

  • I have installed cntlm via sudo apt-get install cntlm (it works from one of the few Ubuntu repositories that randomly work).
  • I edited the configuration at /etc/cntlm.conf and added my username, the domain and the proxy.
  • I started the service (sudo /etc/init.d/cntlm start).
  • I tested the service (sudo cntlm -I -M http://www.google.com/) and the response was Config Profile 1/4... Auth not required (HTTP code: 307) Your proxy is open, you don't need another proxy.
  • I tried performing sudo apt-get update again and still receive the same error message. (401 Authorization Required)
  • (Whoops! My mistake! I see I need to configure apt proxy settings manually...)
  • I added the line Acquire::http::Proxy "http://localhost:3128"; to /etc/apt/apt.conf.
  • I restarted cntlm. (sudo /etc/init.d/cntlm stop, sudo /etc/init.d/cntlm start)
  • I performed sudo apt-get update ... and it hit 0% [Waiting for headers] [Waiting for headers] [Waiting for headers] [Waiting f - and just stopped there.

Steps Taken (after asking)

  • I performed sudo apt-get clean, before performing sudo apt-get update - this started working and then stopped at 19% [Waiting for headers]
  • I performed sudo apt-get clean again, before performing sudo apt-get update - this started working and then stopped at 0% [Waiting for headers]
  • I tried this a third time (sudo apt-get clean, sudo apt-get update) and it stopped at 20% [Waiting for headers]

  • I researched this subsequent problem and found an answer on AskUbuntu, suggesting this may be an issue with IPv6 causing ICS to halt for a while, when it receives concurrent connections.

  • I checked the /etc/sysctl.conf file and discovered the IPv6 already appears to be disabled... (The lines net.ipv6.conf.all.disable_ipv6 = 1, net.ipv6.conf.default.disable_ipv6 = 1, and net.ipv6.conf.lo.disable_ipv6 = 1 are already in the config file.)
  • (I'm now drawing a bit of a blank! The symptoms match the hypothesized IPv6 issue, however, if it is already disabled that doesn't seem to be able to be the cause)
  • I performed sudo apt-get clean and sudo apt-get update a fourth time (What the hell - why not?) and it hung on 24% [Waiting for Headers] this time, but first it hit a bunch of repositories. A repository which used to trigger errors did not do so now (http://cran.rstudio.com trusty /) but one which used to trigger errors now triggered a different error, Received HTTP code 501 from proxy after CONNECT.
  • Try entering the IP of the gateway/proxy in to your browser.
    – Gabriel
    Jul 10, 2014 at 10:28
  • I entered the proxy name into the browser and it gave the same corporate error page but the error was a GATEWAY_TIMEOUT.
    – Eilidh
    Jul 10, 2014 at 10:42
  • Do you still have the same problem? Are you using Unity or something else? Have you tried adding the proxy settings in the proper fields?
    – Braiam
    Aug 16, 2014 at 0:57

1 Answer 1


That probably is an issue to do with the ISA proxy setup in your organization. I had the same issue when configuring a virtual server for my organization.

Open the terminal. In the terminal type in the following command:

sudo nano /etc/apt/apt.conf

This command is meant to open up the apt.conf file and make it available for configuration. If you are prompted for your password, enter it.

Add the following lines into the file:

Acquire::http::proxy "http://[username]:[password]@[proxy_address]:[port]";
Acquire::https::proxy "https:// [username]:[password]@[proxy_address]:[port]";
Acquire::ftp::proxy "ftp:// [username]:[password]@[proxy_address]:[port]";
Acquire::socks::proxy "[username]:[password]@[proxy_address]:[port]";

Where: username - Your proxy username password - Your proxy password proxy_address - The address of the proxy server port - The port on the address server through which traffic is allowed

Save the apt.conf file. Try and run the apt-get command and it should give you something similar to this

sudo apt-get install [package]
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following extra packages will be installed:
Do you want to continue? [Y/n] y:

If you see this response, that means that the package is ready to install.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .