Systemwide proxy settings in ubuntu
Solution 1
Solved it finally:
(Follow the steps serially)
1. For gtk3 programs such as rhythmbox and online accounts:
First you need to enter proxy settings in network settings (along with authentication):
Then apply system wide.
2. For apt,software center etc
edit the file /etc/apt/apt.conf
And then replace all the existing text by the following lines
Acquire::http::proxy "http://username:password@host:port/";
Acquire::ftp::proxy "ftp://username:password@host:port/";
Acquire::https::proxy "https://username:password@host:port/";
3. Environment variables
edit the file /etc/environment
And then add the following lines after PATH="something here"
http_proxy=http://username:password@host:port/
ftp_proxy=ftp://username:password@host:port/
https_proxy=https://username:password@host:port/
That's all..
Solution 2
To download packages by wget proxy have to be setup in /etc/environment, and to download packages by apt-get proxy have to be setup in /etc/apt/apt.conf
Solution 3
That’s not all, of course. Some more programs (npm
, curl
and git
):
npm config set proxy $HTTP_PROXY
npm config set https-proxy $HTTPS_PROXY
npm config set strict-ssl false
echo "proxy = $HTTP_PROXY" > ~/.curlrc
echo "noproxy = $NO_PROXY" >> ~/.curlrc
git config --global http.proxy $HTTP_PROXY
git config --global https.proxy $HTTPS_PROXY
For Maven, edit ~/.m2/settings.xml
. IntelliJ does not seem to pick up the global config either.
Solution 4
To make wget
work with a proxy, I would add also to create a .wgetrc
in your home directory, containing :
http_proxy = http://proxy:port/
https_proxy = http://proxy:port/
proxy_user = user
proxy_password = password
use_proxy = on
wait = 15
Related videos on Youtube
Raman
Updated on September 18, 2022Comments
-
Raman over 1 year
I wanted to use internet on my college proxy server which also requires authentication. I searched google for solutions and the best solution I found yet was this . I have modified the script in the accepted answer to include authentication. Here it goes:
if [ $(id -u) -ne 0 ]; then echo "This script must be run as root"; exit 1; fi if [ $# -eq 4 ] then gsettings set org.gnome.system.proxy mode 'manual' ; gsettings set org.gnome.system.proxy.http host '$1'; gsettings set org.gnome.system.proxy.http port $2; gsettings set org.gnome.system.proxy.http authentication-user '$3'; gsettings set org.gnome.system.proxy.http authentication-password '$4'; grep PATH /etc/environment > lol.t; printf \ "http_proxy=http://$3:$4@$1:$2/\n\ https_proxy=http://$3:$4@$1:$2/\n\ ftp_proxy=http://$3:$4@$1:$2/\n\ no_proxy=\"localhost,127.0.0.1,localaddress,.localdomain.com\"\n\ HTTP_PROXY=http://$3:$4@$1:$2/\n\ HTTPS_PROXY=http://$3:$4@$1:$2/\n\ FTP_PROXY=http://$3:$4@$1:$2/\n\ NO_PROXY=\"localhost,127.0.0.1,localaddress,.localdomain.com\"\n" >> lol.t; cat lol.t > /etc/environment; printf \ "Acquire::http::proxy \"http://$3:$4@$1:$2/\";\n\ Acquire::ftp::proxy \"ftp://$3:$4@$1:$2/\";\n\ Acquire::https::proxy \"https://$3:$4@$1:$2/\";\n" > /etc/apt/apt.conf.d/95proxies; rm -rf lol.t; else printf "Usage $0 <proxy_ip> <proxy_port> <username> <password>\n"; fi
However Online accounts still don't work(same for rhythmbox and other GTK3 programs). A white screen appears like this:
Any suggestions on how it can be solved?
-
David Foerster almost 8 yearsPossible duplicate of How do I set systemwide proxy servers in Xubuntu, Lubuntu or Ubuntu Studio?
-
-
Byte Commander almost 8 yearsPlease elaborate your answer, it is currently not providing much helpful information.
-
David Foerster almost 8 yearsWelcome to Ask Ubuntu! I recommend editing this answer to expand it with specific details about how to do this. (See also How do I write a good answer? for general advice about what sorts of answers are considered most valuable on Ask Ubuntu.)
-
Lucas over 7 yearsDoes step 1) alter /etc/environment? I'd like a way to do that step via the command line.
-
smwikipedia about 7 yearsSeems step 1) works for
apt-get update
as well. So don't need step 2). -
code_dragon over 5 years@Raman I there any need to escape the special characters in password while doing this? If so then how?