Using a proxy is always a pain, but can be done. Since every application or desktop manage proxies another way, it can become really annoying. One way to do it, I’ll show you. In the next few sections I’ll show all my current known locations of proxy settings 😄.

Environment variables

If you’re the single user of your machine or want to set these settings for the machine, you should add these new variables to your /etc/environment:


You might ask, why both in small and capital letters? It happens that some applications seem to use small letters and some capital letters and won’t work if they aren’t defined as expected.

If you don’t want those settings for all users, adding shown variables to the .bashrc, .profile or .zshrc file in your users home folder is the preferred solution.

Too keep those variables also in sudo sessions, we need to add following lines to the /etc/sudoers file:

# Keep Proxy Params in sudo session
Defaults        env_keep+="http_proxy"
Defaults        env_keep+="HTTP_PROXY"
Defaults        env_keep+="https_proxy"
Defaults        env_keep+="HTTPS_PROXY"
Defaults        env_keep+="ftp_proxy"
Defaults        env_keep+="FTP_PROXY"
Defaults        env_keep+="no_proxy"
Defaults        env_keep+="NO_PROXY"

otherwise these variables aren’t set in sudo sessions and might give you “Connection refused” exceptions.


On Debian/Ubuntu based Linux distributions, apt uses a different way to define proxy settings. Even variables in /etc/environment aren’t used in older versions of apt-get.

To use apt with a proxy, create a new file /etc/apt/apt.conf.d/95proxies with:

Acquire::http::proxy "";
Acquire::https::proxy "";
Acquire::ftp::proxy "";

GTK3 Programs

GTK 3 Programs like Rythmbox use different settings, which you can set with these commands:

gsettings set org.gnome.system.proxy mode 'manual' 
gsettings set org.gnome.system.proxy.http host ''
gsettings set org.gnome.system.proxy.http port 8080


If you are using a Linux system with systemd, you can edit the systemd definition of docker and add the variables to the service:

sudo systemctl edit docker

now add:


and depending on which EDITOR you’ve set a :wq or Ctrl+O, Ctrl+X and restart the service

sudo systemctl restart docker

Update Feb 2. 2019: Docker has an own page for setting proxies: Docker Daemon - HTTP Proxy