System wide Proxy settings when on a windows network with a password
Solution 1
First of all, if you are behind a Web Proxy to go to the Internet, you cannot use ping to test the connection to Internet. This is because ping is not able to use any proxy to do its work, it is using its own protocol : ICMP to send and receive packet. Web proxies works only for the TCP protocol.
So if you are able to open any web site in your web browser, then you can be sure that your connection to Internet is working, no reason to do ping to double-check that.
Now regarding your problem with the package manager, if you go to System Settings
-> Network
, you can there define a Web Proxy configuration and apply it system-wide.
When I do so on my laptop, I'm able to use apt-get
without manually configuring Proxy directives into its configuration files.
To work, you have to open your terminal after having clicked the Apply system-wide button. (Setting cannot be applied to already running program, only to those starting after you apply the settings).
UPD: More about Proxies and authentication
Another source of problem, as you are in Windows environment, may be the authentication mechanisms used on your web proxy. If this proxy is configured to use NTLM, it is possible that some application cannot authentify to it. In this case, what you can do is to install a local proxy supporting NTLM like cntlm, running it on 127.0.0.1 is enough and pointing it to your real Web Proxy. Then just use this local proxy as default proxy for your Ubuntu system.
Solution 2
Use this command and see if your Proxy setting is correct.
sudo gedit /etc/apt/apt.conf
It contains following content :
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 "socks://username:password@proxy-address:port/";
You must input your username
password
proxy-address
and port
instead of these id
Solution 3
You will need to modify your /etc/apt/apt.conf
file correctly as follows:
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 "socks://username:password@proxy-address:port";
Note the ::
in place of :
before Proxy
, replacing username
, password,
proxy-addressand
proxy` with the ones applicable to you.
Also, do note that, if you have special characters like @
, you will need to replace them with their respective HTML codes.
And after you have done this, and if you have never updated your system, you will need to do:
sudo apt-get update
and then you will be able to install packages.
If this doesn't help, open your /etc/environment
file (using gksudo gedit /etc/environment) and then type the following:
export http_proxy="http://username:password@proxy-address:port"
export https_proxy="https://username:password@proxy-address:port"
export ftp_proxy="ftp://username:password@proxy-address:port"
export socks_proxy="socks://username:password@proxy-address:port"
And then do source /etc/environment
and then try again.
Related videos on Youtube
sav
Updated on September 18, 2022Comments
-
sav over 1 year
I'm using Ubuntu on a windows network. I want to connect to the world wide web. I have followed the steps here which I have found very useful. However when I try to ping a website (eg: ping www.wikipedia.org) I get no reply. I can ping local computers on my network, but I need to go through our proxy to get to the world wide web.
I can even browse wikipedia using firefox, I just needed to enter the proxy configuration script location and my username and password.
I'm quite sure the reason I'm having this trouble is because I havn't entered a username and password. I'm not sure how to do this on a system wide level.
ultimately I would like to be able to use package managers like synaptic but first I need them to be able to connect to the internet.
EDIT
As sugested I created a /etc/apt/apt.conf file like
Acquire::http::Proxy "http://chrisav:[email protected]:8080"; Acquire::https::Proxy "https://chrisav:[email protected]:8080"; Acquire::ftp::Proxy "ftp://chrisav:[email protected]:8080"; Acquire::socks::Proxy "socks://chrisav:[email protected]:8080";
However I still cant ping wikipedia
when I try installing stuff I get
chris@chris-Ubuntu:~$ sudo apt-get install kate Reading package lists... Done Building dependency tree Reading state information... Done E: Unable to locate package kate
-
sav almost 10 yearsDo I need to include a domain name in there anywhere?
-
sav almost 10 yearsThanks, I'm getting an error though chris@chris-Ubuntu:~$ sudo apt-get install synaptic E: Syntax error /etc/apt/apt.conf:7: Extra junk at end of file
-
αғsнιη almost 10 yearsPut semicolon
;
at the end of each line and save it again. And Also Note the::
in place of:
before Proxy -
sav almost 10 yearsI've just added the ; in
-
sav almost 10 yearswell spotted, I have added the extra : character now as well. Still no luck
-
jobin almost 10 years@sav: answer edited, have a look.
-
αғsнιη almost 10 yearsCan you open any pages on your browser (ex:Firefox)?
-
sav almost 10 yearsYes. that works no trouble.
-
sav almost 10 yearsI should also mention that I'm using ubuntu from inside virtualbox.
-
αғsнιη almost 10 years
E: Unable to locate package pkgname
superuser.com/questions/34894/… -
jobin almost 10 years@sav: You need to do
sudo apt-get update
before you dosudo apt-get install kate
. -
sav almost 10 yearsHmm yes, but the problem is I'm still not getting through to the internet so this just gets stuck at 0%
-
jobin almost 10 yearsDoes your password have any special character, if yes, have you replaced them with their HTML codes?
-
sav almost 10 yearsI have even tried temporarily changing to a simple password to avoid this
-
jobin almost 10 years@sav: Edited my answer, can you retry?
-
becko over 9 yearsIs there a way to set specific domains which should NOT use proxy? Something analogous to the
No proxy for
setting in Firefox...