Tutorial

How to Set Up a Proxy on Debian

Debian keeps a proxy in five places that do not share it. Each step for GNOME, the terminal, apt and sudo, tested on Debian 13 with real screenshots.

HProxy Team··Updated October 3, 2026·20 min read
HProxy.Tutorial

Free proxies won't hold up here.

Shared datacenter IPs get flagged and dropped fast. When it has to hold, gaming, streaming, accounts, you need mobile and residential IPs that read as a real device, from $0.44/GB, pay as you go.

See plans & pricing→

Debian keeps a proxy setting in five places, and each one reaches a different set of programs. Set it in the GNOME panel and Firefox follows, while sudo apt update still goes straight out. Pick the place that reaches the program you care about, then prove it with one command.

This page does not repeat other guides. On 3 October 2026 we installed Debian 13.5, the current stable release, and ran every step on it against three test proxies that log each request they receive. Every screenshot below is the real screen, every terminal picture is the real output, and every error message is the one Debian printed. Debian 12 ships the same sudo and login files and documents the same apt options; the desktop screenshots show Debian 13's GNOME 48.

Where you set itWhat it reachesWhat it leaves out
GNOME Settings, Network, ProxyFirefox on its default setting, Chromium, Chrome, GNOME's appsTerminals, apt, sudo
export in a terminalcurl, wget and apt started in that terminalOther terminals, anything under sudo
/etc/environmentThe next login: GNOME, the text console, SSHTerminals already open, anything under sudo
/etc/apt/apt.conf.d/apt, with sudo or as rootEverything that is not apt
/etc/sudoers.d/Your proxy names, carried into sudoUsers outside the sudo group
Who follows which setting on Debian

Follow the desktop setting

  • Firefox

    on its default, Use system proxy settings (measured on Firefox ESR 153)

  • Chromium and Chrome

    read GNOME's setting when they run in GNOME

  • GNOME's own apps

    the ones that use the network connection

Read their own setting

  • apt

    Acquire::http::Proxy, or the http_proxy variable

  • curl and wget

    http_proxy and https_proxy, in lower case

  • Anything run with sudo

    starts with a short list of variables, no proxy

Source: Our Debian 13.5 test machine, 3 October 2026; apt-transport-http(1) and sudoers(5) of Debian 13, the curl and wget manuals, Chromium's Linux proxy notes

What you need before you start

One proxy line, four parts

198.51.100.7Host:8080Port:hp_ir4k2Username:9fa2c1Password
  • 198.51.100.7:8080:hp_ir4k2:9fa2c1host:port:user:passMost proxy tools and checkers
  • hp_ir4k2:9fa2c1@198.51.100.7:8080user:pass@host:portcurl, requests, most HTTP clients
  • http://hp_ir4k2:9fa2c1@198.51.100.7:8080http://user:pass@host:portAnything taking a full proxy URL

The desktop panel takes the host and the port. The terminal, /etc/environment and apt take all four, written as one address. Values shown are examples.

  • A proxy address as host:port, plus a user name and password if the proxy needs a login. If your provider sent the four values in another order, the proxy format guide sorts them out.
  • A terminal. Every step except the desktop one works on a server without a desktop.
  • Root rights for steps 4 and 5. Debian's installer gives your first user sudo when the root password was left empty during installation; otherwise run those steps as root.
  • For a first test, any HTTP entry from our free proxy list will do. Free entries come and go, so test one first; the check further down shows how.
Our free proxy list filtered to HTTP on 2 October 2026: 8,276 entries, each row with its address and port, country, anonymity, uptime, speed and a Copy button.
Captured on 2 October 2026 at hproxy.com/free-proxy-list/http. The address and port of a row are the host:port the steps below ask for.

Step 1: the desktop (GNOME)

Debian installs GNOME when you choose a desktop, unless you pick another one. In GNOME Settings 48, the version in Debian 13, the proxy sits on the Network page:

GNOME Settings 48 on Debian 13.5 with the Network page open: mark 1 on Network in the sidebar, mark 2 on the row Proxy, which still reads Off.
Our Debian 13.5 test machine, 3 October 2026: (1) Network, (2) the Proxy row.
  1. Open Settings and choose Network (1).
  2. Click the Proxy row (2).
  3. Turn on Network Proxy (3).
  4. Set Configuration to Manual (4).
  5. Under HTTP Proxy, put the proxy's address into URL and its port into Port (5), then the same under HTTPS Proxy (6). For a SOCKS proxy, fill in SOCKS Host instead.
  6. Press Save (7) at the top. Nothing changes until you do; afterwards the Network page shows the row as Manual.
The GNOME Proxy page filled in: Network Proxy switched on, Configuration Manual, HTTP and HTTPS each with the URL 198.51.100.7 and the Port 8080, and the Save button at the top, numbered 3 to 7.
The same window after steps 3 to 6, with the example address 198.51.100.7. The HTTP port starts at 8080 and the HTTPS port at 0, so check both before you save.

Three things the screen does not tell you. The page has no field for a user name or password; the page ends with Ignored Hosts, which holds localhost, 127.0.0.0/8, ::1 from the start. GNOME's own help text still describes an older layout, with Network proxy in a list on the left, so trust the steps above on Debian 13. And the setting is for desktop apps only: curl, wget and apt never read it.

Firefox

Firefox, which Debian's desktop installs, follows this setting out of the box. A new Firefox ESR 153 profile on our machine opened its Connection Settings on Use system proxy settings, and with GNOME pointed at our test proxy, Firefox's page loads went through it. To check yours, open Firefox's settings, choose Privacy and security (1), and in Connection and software security press Configure proxy (2):

Firefox ESR 153 settings on Debian 13.5: mark 1 on Privacy and security in the sidebar, mark 2 on Configure proxy under Proxy settings.
Firefox ESR 153.4 on our Debian 13.5 test machine. Typing proxy into Find in Settings leads to the same page.
Firefox's Connection Settings dialog with Use system proxy settings selected, marked 3, above the unused manual fields.
(3) Where a new profile starts. The dialog also notes that connections to localhost, 127.0.0.1/8 and ::1 are never proxied.

If your proxy needs a login, Firefox asks for it the first time it connects, because GNOME's page has no field for one. On our machine, with GNOME pointed at our test proxy that wants a password, this appeared at once, and after signing in the pages loaded through the proxy:

Firefox's prompt: The proxy moz-proxy://127.0.0.1:8889 is requesting a username and password. The site says: lab, with Username and Password fields and a Sign in button.
Firefox ESR 153.4 asking for the login of our test proxy. In this box you type the password as it is, with no encoding.

Chromium and Chrome read GNOME's setting the same way when they run in GNOME. On KDE Plasma the desktop keeps a proxy setting of its own, which Chromium reads too; this page does not cover KDE's screens.

Step 2: set the proxy for this terminal

export http_proxy="http://user:pass@host:port" https_proxy="http://user:pass@host:port" no_proxy="localhost,127.0.0.1,::1"

Both names start with http://, the one for HTTPS too, because they name the proxy, and the proxy itself speaks plain HTTP. Write the port every time; without one, curl assumes 1080.

Write the names in lower case. The curl manual says http_proxy is read only in lower case, and on our Debian machine the upper-case name did nothing at all:

Terminal on Debian 13.5: with HTTP_PROXY in upper case pointing at a closed port, curl connected straight to deb.debian.org; with http_proxy in lower case, curl used it and failed against the closed port.
(1) Upper case only: curl ignores it and connects directly. (2) Lower case: curl uses it at once. Port 9 is closed on purpose, so the failure proves the name was read.

The setting lives until you close the terminal. The Linux page has the details per tool for curl, wget, git and pip.

Step 3: make it permanent

For yourself, add the same line to the end of ~/.bashrc. Every new terminal reads it, and on Debian 13 your home folder is private (mode 700), so a password in that file stays yours.

For every user, put the names into /etc/environment, one plain NAME=value line each:

http_proxy=http://user:pass@host:port
https_proxy=http://user:pass@host:port
no_proxy=localhost,127.0.0.1,::1

The PAM module pam_env reads this file when you log in; on Debian the GNOME login, the text console and SSH all run it. Terminals that are already open do not see the change, so log out and back in. sudo does not read it at all:

Terminal on Debian 13.5: /etc/environment holds the proxy names; after a login env shows them; sudo env shows nothing.
(1) After a login the names from /etc/environment are set. (2) Under sudo they are gone: Debian's /etc/pam.d/sudo has no pam_env line. Step 5 fixes that.

/etc/environment can be read by every user on the machine. On a shared computer, keep a password out of it and use ~/.bashrc or the apt file below.

Step 4: give apt its own setting

apt does not read the desktop panel, and under sudo it does not see your shell's names either. It reads its own option, which works the same with sudo or in a root shell. One line in a file of its own is enough:

echo 'Acquire::http::Proxy "http://user:pass@host:port/";' | sudo tee /etc/apt/apt.conf.d/99proxy
sudo chmod 600 /etc/apt/apt.conf.d/99proxy

On our Debian 13.5 machine, whose package sources start with https://, this single line carried every source through the proxy:

Terminal on Debian 13.5: the sources use https, 99proxy holds only Acquire::http::Proxy, apt-config dump shows it, apt-get update runs, and the test proxy received CONNECT requests for deb.debian.org and security.debian.org.
(1) Sources on https. (2) One http line. (3) Both mirrors went through our test proxy anyway. Add Acquire::https::Proxy only if https sources need a different proxy.

The chmod 600 matters if the line holds a password. The file is created readable by every user, and on our machine a normal account could print the password with cat. After chmod 600 apt still worked through our login proxy, and the same account got Permission denied:

Terminal on Debian 13.5: 99proxy and /etc/environment created with mode 644, a normal user reads the proxy password, chmod 600, apt-get update still goes through the login proxy, the normal user now gets Permission denied.
(1) Any user can read the password. (2) chmod 600. (3) apt still works, the normal user is locked out.

The manual for apt's HTTP method gives the form scheme://[[user][:pass]@]host[:port]/ and three schemes: http, https and socks5h. To send one host past the proxy, for example a mirror on your own network, give it the value DIRECT:

echo 'Acquire::http::Proxy::mirror.example.com "DIRECT";' | sudo tee -a /etc/apt/apt.conf.d/99proxy

apt also honours no_proxy from the environment. Then ask apt what it will actually use:

apt-config dump | grep -i proxy

apt-config dump prints apt's whole configuration, so this line shows the proxy apt has, whichever file it came from. If it prints an address you did not just write, read the next box.

Did you type a proxy into the Debian installer?

The installer asks for one while it sets up the package mirror: HTTP proxy information (blank for none). Whatever you typed there was written into /etc/apt/apt.conf as Acquire::http::Proxy, and it is still there. apt reads that file after everything in /etc/apt/apt.conf.d/, and a later value replaces an earlier one, so the installer's line beats your new file. sudo grep -rni proxy /etc/apt/ shows every line that mentions a proxy; change or delete the old one.

We rebuilt that situation on our test machine, with the installer's line pointing at a proxy that no longer runs:

Terminal on Debian 13.5: /etc/apt/apt.conf holds a proxy on 127.0.0.1:3128 next to a working 99proxy; apt-config dump shows the old line winning; apt-get update fails with Could not connect to 127.0.0.1:3128 Connection refused; grep finds the line; after removing apt.conf, apt-config shows the working proxy and apt-get update succeeds.
(1) The installer's line wins over 99proxy. (2) The error apt prints. (3) grep finds the culprit. (4) Gone, and apt uses the right proxy.

Step 5: carry the proxy into sudo

sudo runs every command in a minimal environment. Its manual lists what survives: TERM, PATH, HOME, MAIL, SHELL, LOGNAME, USER and the SUDO_* names. Your http_proxy is not on that list.

What sudo does with your proxy on Debian
  1. Your shellhttp_proxy is set
  2. sudokeeps only its short list
  3. aptfinds no proxy, goes straight out

Debian's default, without the apt file from step 4

  1. Your shellhttp_proxy is set
  2. sudoenv_keep passes it on
  3. aptuses the proxy

With the line in /etc/sudoers.d/proxy

Source: Debian 13's /etc/sudoers (sudo 1.9.16p2) and sudoers(5), env_reset and env_keep

On our test machine it looked like this. The names were set in the shell, gone under sudo, and our test proxy received nothing from sudo apt-get update:

Terminal on Debian 13.5: env shows http_proxy and https_proxy, sudo env shows nothing, sudo apt-get update runs, and the test proxy received 0 requests.
(1) sudo shows no proxy names. (2) apt went straight out: 0 requests at the proxy.

For a single command, sudo -E keeps your environment; Debian's default rule for the sudo group allows it. For good, Debian has already written the line for you. Its own /etc/sudoers carries it, switched off:

# This preserves proxy settings from user environments of root
# equivalent users (group sudo)
#Defaults:%sudo env_keep += "http_proxy https_proxy ftp_proxy all_proxy no_proxy"

The top of the same file asks for local changes in /etc/sudoers.d/ and says to edit with visudo, which checks the file for mistakes before it saves anything. Open a new file there:

sudo visudo -f /etc/sudoers.d/proxy

Then type the line without the #, save and close:

Defaults:%sudo env_keep += "http_proxy https_proxy ftp_proxy all_proxy no_proxy"
Terminal on Debian 13.5: the commented line in /etc/sudoers, the same line written to /etc/sudoers.d/proxy and checked by visudo, sudo env now showing both proxy names, and the test proxy receiving apt's requests.
(1) visudo accepts the file. (2) sudo now keeps the names. (3) apt under sudo goes through the proxy.

From then on, members of the sudo group keep their proxy names under sudo. The line passes on what is already set; it sets nothing itself, so steps 2 and 3 still decide which proxy that is. If a typo does slip into that file, sudo 1.9.16 on our machine printed the same error as visudo and carried on without the broken line, so the names were dropped again; open it with visudo and fix it.

A proxy with a user name and password

Put both into the address: http://user:pass@host:port. Characters that have a meaning in an address must be written encoded, an @ as %40 and a colon as %3a. On our test machine, with a password containing an @:

Terminal on Debian 13.5: curl refuses a proxy address with a plain @ in the password (Unsupported proxy syntax, Bad hostname), accepts it written as %40 (200), fails with a wrong password (CONNECT tunnel failed, response 407), and apt prints Invalid response from proxy: HTTP/1.1 407 Proxy Authentication Required.
(1) A plain @ breaks the address for curl. (2) %40 works. (3) A wrong password in curl. (4) The same mistake in apt; the line is longer on screen.

apt happened to accept the plain @ in our test, but write %40 anyway: the same line ends up in curl, wget and your shell, and curl refuses it. In Firefox's login box you type the password as it is.

A SOCKS5 proxy

apt and curl both take socks5h://, a SOCKS5 proxy that also resolves the host names, so your DNS lookups go through the proxy too:

printf 'Acquire::http::Proxy "socks5h://user:pass@host:port/";\nAcquire::https::Proxy "socks5h://user:pass@host:port/";\n' | sudo tee /etc/apt/apt.conf.d/99proxy
curl -x socks5h://user:pass@host:port https://www.debian.org/
Terminal on Debian 13.5: 99proxy with socks5h lines, apt-get update succeeding, curl through socks5h answering 200, and the SOCKS5 test proxy's log showing connections to deb.debian.org and security.debian.org.
(1) Our SOCKS5 test proxy saw apt's connections. (2) curl through the same proxy.

A proxy for one command only

Put the name in front of the command, and it applies to that command alone:

https_proxy=http://user:pass@host:port curl https://www.debian.org/
sudo apt -o Acquire::https::Proxy=http://user:pass@host:port/ update

The -o form also works the other way round. With a proxy configured, -o Acquire::https::Proxy=DIRECT skips it for that one run, which helps when the proxy is down and you need one package now:

Terminal on Debian 13.5: apt-get with -o Acquire::https::Proxy pointing at the test proxy sends its requests there; with 99proxy configured, apt-get with -o Acquire::https::Proxy=DIRECT sends nothing to the proxy.
(1) One run through the proxy, no file needed. (2) One run without the configured proxy: 0 requests at the proxy.

Other programs on Debian

wget reads http_proxy and https_proxy too, or a file of its own; git has its own option; and proxychains4 sends a program through the proxy that has no proxy setting at all. All three went through our test proxy:

printf 'use_proxy = on\nhttps_proxy = http://user:pass@host:port/\n' >> ~/.wgetrc
git config --global http.proxy http://user:pass@host:port
sudo apt install proxychains4

For proxychains4, write the proxy into ~/.proxychains/proxychains.conf (or /etc/proxychains4.conf for everyone) under [ProxyList], as http host port, and start a program with proxychains4 -q in front of it.

Terminal on Debian 13.5: wget with ~/.wgetrc, git ls-remote with http.proxy, and proxychains4 running curl, followed by the test proxy's log showing two requests to deb.debian.org and one to github.com.
(1) wget and proxychains4 reached deb.debian.org through the proxy. (2) git reached github.com through it.

Docker needs two settings, and neither comes from your shell. docker pull is done by the Docker daemon, which takes its proxy from a systemd drop-in, /etc/systemd/system/docker.service.d/http-proxy.conf, holding Environment lines for HTTP_PROXY and HTTPS_PROXY; restart Docker after writing it. Builds and containers take theirs from ~/.docker/config.json instead. Both come from Docker's own documentation; we did not run Docker for this page.

GNOME's setting from the terminal

What the GNOME page saves can be read and switched from a terminal, which helps on a remote desktop or in a script:

Terminal on Debian 13.5: gsettings shows mode manual, the HTTP and HTTPS host and port saved by the GNOME page, the ignore-hosts list, then switches the mode to none and back to manual.
(1) The mode GNOME saved. (2) The hosts that skip the proxy. gsettings set org.gnome.system.proxy mode 'none' switches it off.

Check that it worked

curl -sv -o /dev/null https://www.debian.org/ 2>&1 | grep -E 'Uses proxy|Connected to'
curl -s https://www.cloudflare.com/cdn-cgi/trace | grep ^ip=
curl -s https://hproxy.com/api/ip/THE_ADDRESS_YOU_JUST_SAW
apt-config dump | grep -i proxy
sudo env | grep -i _proxy

The first line is the quickest proof. When curl really uses a proxy, it says so, and it names where it connected:

Terminal on Debian 13.5: curl -v printing Uses proxy env variable https_proxy, CONNECT tunnel established, response 200, and Connected to 127.0.0.1 port 8888.
(1) curl took the proxy from https_proxy. (2) It connected to the proxy, not to the site.

The second line prints the address a site sees; if it is the proxy's address, your traffic goes through the proxy. The third takes that address and returns its country, city, network and AS number. The last two show what apt will use and what survives sudo. Then paste the entry into our free proxy checker, which reports status, protocol, anonymity, country and latency for every line. Free entries stop answering without notice; when a download has to finish, use a paid proxy instead.

When it does not work: the messages Debian prints

Every message below is copied from our test machine, so you can search this page for the exact words on your screen.

Error messages on Debian 13, what they mean, and the fix

What you seeWhat it meansFix
Could not connect to 127.0.0.1:3128 (127.0.0.1). - connect (111: Connection refused)apt uses a proxy that is not running at that address. Often the installer's old line.sudo grep -rni proxy /etc/apt/, then fix or delete the line.
Invalid response from proxy: HTTP/1.1 407 Proxy Authentication Requiredapt reached the proxy, but the login was missing or wrong.Check the user name and password; encode @ as %40.
curl: (56) CONNECT tunnel failed, response 407The same login problem, in curl.Same fix.
Could not wait for server fd - select (11: Resource temporarily unavailable)The proxy address starts with https:// but the proxy speaks plain HTTP. On our machine apt waited six minutes first.Write http:// in front of the proxy.
curl: (5) Unsupported proxy syntax in '...': Bad hostnameAn unencoded @ or : in the password split the address.Write %40 and %3a.
curl: (7) Failed to connect to ... port ...: Could not connect to serverNothing answers at that address and port.Check host and port; the proxy may be down.
N: Ignoring file 'proxy.txt' in directory '/etc/apt/apt.conf.d/' as it has an invalid filename extensionapt skipped your file because of its name. Only apt-config says so; apt update stays silent.Name it 99proxy or proxy.conf.
E: Syntax error /etc/apt/apt.conf.d/proxy.conf:2: Extra junk at end of fileA line lacks its closing ;.End every line with ";.
/etc/sudoers.d/proxy:1:51: unexpected line break in stringA quote is missing in the sudoers line.sudo visudo -f /etc/sudoers.d/proxy and fix it.

Our Debian 13.5 test machine, 3 October 2026

Terminal on Debian 13.5: a file named proxy.txt is ignored and only apt-config prints the notice about its extension; renamed to proxy.conf it is read; with the closing semicolon missing apt stops with Syntax error, Extra junk at end of file.
(1) The wrong extension, reported only by apt-config. (2) Renamed, the proxy is read. (3) A missing semicolon stops apt.

These come up in guides that rank for Debian proxy searches. We tried each one on our test machine:

  • https:// in front of an ordinary proxy. apt waited six minutes and failed; curl was still waiting after a minute. With http:// the same proxy answered at once.
  • A password with @ or # written as it is. curl refuses the address, as shown above.
  • Only the upper-case HTTP_PROXY. curl ignores it for http:// addresses.
  • ~/.docker/config.json for docker pull. That file covers builds and containers; pulls take the daemon's setting.
  • Network proxy in a list on the left of GNOME Settings. That layout is gone in GNOME 48; the proxy is a row on the Network page.

The first one is the costliest, because nothing tells you what is wrong until the time runs out:

Terminal on Debian 13.5: with Acquire::https::Proxy set to https://127.0.0.1:8888, apt-get update fails with Could not wait for server fd after a measured 6 minutes 1 second; curl with an https:// proxy is cut off after 60 seconds; with http:// the same proxy returns 200.
(1) apt's message. (2) Six minutes for it. (3) curl still waiting at 60 seconds. (4) The same proxy with http://.

Turning it off again

Each place is separate, and a forgotten one keeps sending traffic to a proxy that no longer exists:

  • In open terminals, run unset http_proxy https_proxy no_proxy, and remove your line from ~/.bashrc.
  • Remove the lines from /etc/environment, then log out and back in.
  • Run sudo rm /etc/apt/apt.conf.d/99proxy, and delete any Acquire::http::Proxy line the installer left in /etc/apt/apt.conf.
  • Run sudo rm /etc/sudoers.d/proxy.
  • Switch Network Proxy off in GNOME Settings, or run gsettings set org.gnome.system.proxy mode 'none'.

How we tested

Debian 13.5 from the official Debian image, run on our own workstation in WSL 2 with systemd, apt 3.0.3 and sudo 1.9.16p2. Three test proxies ran next to it, each logging every request: tinyproxy as an open HTTP proxy, squid with a user name and a password containing an @, and microsocks as a SOCKS5 proxy. GNOME Settings 48.4 and Firefox ESR 153.4 ran on a virtual screen, with Debian's default font; the screenshots are that screen, cut to size, with numbers added. Each step started from a clean state, and the proxies' logs, not apt's own output, decided where the traffic went.

Limits: WSL brings Microsoft's kernel, not a bare-metal Debian install, and the desktop programs ran without a full GNOME session. Debian 12 was not run; its sudo and login files were read and match Debian 13's. Docker and KDE were not tested.

Sources

All read on 2 and 3 October 2026.

  • Our test run on Debian 13.5, 3 October 2026: 21 experiments, the transcripts behind every terminal picture, and the GNOME and Firefox screens.
  • apt-transport-http(1), apt-transport-https(1), apt.conf(5) and apt-config(8), Debian 13: the proxy form, socks5h, DIRECT, no_proxy and the order apt reads its files (manpages.debian.org).
  • apt-transport-http(1), Debian 12: the same proxy options, no_proxy included (manpages.debian.org).
  • sudoers(5) and visudo(8), Debian 13: env_reset, sudo -E for rules that match ALL, and the syntax check (manpages.debian.org).
  • pam_env(8), Debian 13: /etc/environment (manpages.debian.org).
  • Debian's own files for Debian 13: /etc/sudoers and /etc/pam.d/sudo of sudo 1.9.16p2, the PAM files of gdm3 48, util-linux and openssh, the installer's choose-mirror 2.133 and apt-setup 0.198, and tasksel 3.81; for Debian 12, /etc/sudoers, /etc/pam.d/sudo and the login files (sources.debian.org).
  • Debian 13 installation guide, section 6.3: the default desktop and sudo; Debian 13 release announcement of 9 August 2025 (debian.org).
  • Define proxy settings, GNOME Help (help.gnome.org), which still shows the older layout.
  • Linux Proxy Config, Chromium Docs (chromium.googlesource.com).
  • Connection settings in Firefox, Mozilla Support; the default proxy type of Firefox ESR (searchfox.org).
  • Daemon proxy configuration, and Use a proxy server with the Docker CLI, Docker Docs (docs.docker.com).
  • The curl man page: http_proxy in lower case, and the --proxy option; wget(1), Debian 13.
  • Our own measurements on our Ubuntu 24.04.4 server, 16 September 2026: sudo and sudo -E, and the upper- and lower-case names with curl.

Frequently asked questions

How do I set a proxy on Debian?
Pick the place that reaches the program you care about. On the desktop, GNOME Settings, Network, Proxy covers Firefox, Chrome and GNOME's own apps. For the open terminal, export http_proxy and https_proxy. For every login, put the same names into /etc/environment. For apt, write one Acquire::http::Proxy line into a file under /etc/apt/apt.conf.d/. To keep the names under sudo, put Debian's own env_keep line into a file in /etc/sudoers.d/.
Why does sudo apt update ignore my proxy on Debian?
Because sudo starts every command in a minimal environment, so the http_proxy of your shell never reaches apt. On our Debian 13.5 test machine, sudo env showed no proxy names and sudo apt-get update sent nothing to the proxy. Debian's own /etc/sudoers already holds the fix as a switched-off line; put it into /etc/sudoers.d/proxy with visudo, use sudo -E for one command, or give apt its own setting, which needs no environment at all.
Does /etc/environment reach sudo on Debian?
No. The GNOME login, the text console and SSH read /etc/environment through pam_env, but Debian's /etc/pam.d/sudo has no pam_env line. On our Debian 13.5 machine the names were set after a login and gone under sudo. Use the env_keep line in /etc/sudoers.d/ or the apt file.
Do I need both Acquire::http::Proxy and Acquire::https::Proxy?
No. On Debian 13 one Acquire::http::Proxy line also carried apt's https sources through the proxy in our test. Add Acquire::https::Proxy only if https sources should use a different proxy.
Where does the proxy in /etc/apt/apt.conf come from?
From the installer. If you answered its question HTTP proxy information (blank for none), Debian's installer wrote the answer as Acquire::http::Proxy into /etc/apt/apt.conf. apt reads that file after everything in /etc/apt/apt.conf.d/, so the old line wins over a new file there. Change or delete it once that proxy is gone.
Why does apt hang for minutes with my proxy?
Most often the proxy address starts with https:// while the proxy speaks plain HTTP. On our test machine apt waited six minutes and then failed with Could not wait for server fd - select (11: Resource temporarily unavailable). Write http:// in front of the proxy, also for Acquire::https::Proxy.
What does 407 Proxy Authentication Required mean in apt?
The proxy wants a user name and password and did not get the right ones. apt prints Invalid response from proxy: HTTP/1.1 407 Proxy Authentication Required, and curl prints CONNECT tunnel failed, response 407. Check both values and write special characters encoded, an @ as %40 and a colon as %3a.
How do I use a proxy for one apt command only?
Pass the option on the command line: sudo apt -o Acquire::https::Proxy=http://host:port/ update. The same option with the value DIRECT skips a proxy that is configured, for that one run; our test proxy received no request during it.
Can apt use a SOCKS5 proxy on Debian?
Yes. apt on Debian 13 accepts socks5h:// addresses, a SOCKS5 proxy that also resolves the host names, next to http:// and https://. Write Acquire::http::Proxy "socks5h://user:pass@host:port/"; and the same for Acquire::https::Proxy. It worked on our test machine for apt and for curl.
Does the GNOME proxy setting cover the terminal?
No. Firefox follows it while its own Connection Settings stay on Use system proxy settings, which is where a new Firefox ESR 153 profile starts, and Chromium and Chrome read it when they run in GNOME. curl, wget and apt read environment variables and apt's own option instead.
Does Docker on Debian use my proxy?
Not from your shell. docker pull goes through the Docker daemon, which takes its proxy from a systemd drop-in such as /etc/systemd/system/docker.service.d/http-proxy.conf; ~/.docker/config.json sets the proxy for builds and containers only. Both come from Docker's own documentation.
How do I check my proxy settings on Linux?
env | grep -i _proxy shows what your shell passes on, apt-config dump | grep -i proxy shows what apt will use, sudo env | grep -i _proxy shows what survives sudo, and gsettings get org.gnome.system.proxy mode shows the desktop setting. curl -v prints a line Uses proxy env variable when it really uses one.
How do I turn the proxy off again on Debian?
Each place on its own: unset the variables, remove your lines from ~/.bashrc and /etc/environment, delete /etc/apt/apt.conf.d/99proxy and any Acquire::http::Proxy line in /etc/apt/apt.conf, delete /etc/sudoers.d/proxy, and switch Network Proxy off in GNOME Settings. A forgotten place keeps sending traffic to a proxy that is gone.

Proxies that don't die mid-job

Residential, ISP, datacenter and mobile, verified by the same engine that runs tens of millions of checks. They read as a real device and hold up under load. Pay as you go, and your balance never expires. $0.44/GB is the 2,000 GB+ rate; a single gigabyte is $0.50/GB, with no minimum order.

129M+ proxy checks run · 100+ countries · HTTP / HTTPS / SOCKS · re-checked every few minutes · no signup

HProxy.

Honest guides and comparisons on proxies, scraping and staying unblocked, from the team that runs the network.

RSS feed