wget Guide · 1 min read

How to use a proxy with wget

wget reads proxies from environment variables or its own .wgetrc, and takes credentials through dedicated flags. Here is every method, plus the one thing to know: wget speaks HTTP proxies, not SOCKS5.

wget speaks HTTP proxies

The single most important fact about wget and proxies: classic wget supports HTTP and HTTPS proxies only — it has no native SOCKS5 support. So with s4m you point wget at the HTTP endpoint, proxy.s4m.online:3128, authenticated with your USER:PASS. If you specifically need SOCKS5, either use curl instead, or wrap wget with a SOCKS-aware helper such as proxychains.

Within HTTP proxying, wget is flexible. It honours the standard http_proxy, https_proxy and no_proxy environment variables, reads persistent settings from ~/.wgetrc, and accepts per-command overrides via -e plus --proxy-user and --proxy-password. That makes it easy to set a proxy globally for scripted downloads while still overriding it for a single fetch. See the proxy page for endpoints and the proxy environment variables guide for how these variables are shared across CLI tools.

wget proxy, every method

Environment variables, .wgetrc, and inline flags, all with authentication. Replace USER:PASS before running.

bash
# --- Method 1: environment variables (per shell/session) ---
export http_proxy="http://USER:[email protected]:3128"
export https_proxy="http://USER:[email protected]:3128"
export no_proxy="localhost,127.0.0.1,.internal"
wget https://ftp.gnu.org/gnu/wget/wget-1.21.tar.gz

# --- Method 2: inline flags for one command ---
wget -e use_proxy=yes \
     -e https_proxy=proxy.s4m.online:3128 \
     --proxy-user=USER --proxy-password=PASS \
     https://example.com/file.iso

# --- Method 3: persistent ~/.wgetrc ---
cat > ~/.wgetrc <<'RC'
use_proxy = on
https_proxy = http://proxy.s4m.online:3128
http_proxy  = http://proxy.s4m.online:3128
proxy_user = USER
proxy_password = PASS
RC
wget https://example.com/file.iso   # reads ~/.wgetrc automatically

# --- Bypass the proxy for one download ---
wget --no-proxy https://internal.example/file

# --- Need SOCKS5? wget can't do it natively; wrap it: ---
# proxychains -f s4m.conf wget https://example.com/file.iso

Which method to use

Match the method to how repeatable the download is.

One-off download

Use inline flags: -e https_proxy=... with --proxy-user and --proxy-password. Nothing persists, so it is safe on shared machines.

Whole session or script

Export http_proxy and https_proxy. Every wget (and most other CLI tools) in that shell shares the exit until you unset them.

Permanent per-user config

Put the settings in ~/.wgetrc so every wget run is proxied automatically. Good for a dedicated download box you control.

Need SOCKS5

wget cannot do SOCKS5 natively. Use curl's --socks5-hostname, or wrap wget with proxychains pointed at proxy.s4m.online:1080.

Auth, no_proxy and honesty

Credentials can go inline in the proxy URL (http://USER:PASS@host:3128) or in the dedicated --proxy-user / --proxy-password flags — the latter keeps the password out of the URL and out of some process listings. Always set no_proxy for internal hosts you never want routed through the proxy, and remember that inline flags override environment variables, which override ~/.wgetrc.

s4m proxies are authenticated datacenter HTTP (and SOCKS5) endpoints, metered pay-as-you-go — great for scripted downloads, mirroring and CI fetches where you want a stable, hidden exit. They are not residential, so a site that blocks datacenter ranges may refuse the download. For a single consistent address, add a dedicated personal IP. If a fetch returns 407, your credentials are wrong — see the 407 guide. Test open HTTP proxies from the free list and validate endpoints with the tools.

FAQ

Questions, answered

Can wget use a SOCKS5 proxy?

Not natively — classic wget supports HTTP and HTTPS proxies only. Point it at the s4m HTTP endpoint on port 3128, or if you need SOCKS5, use curl's --socks5-hostname or wrap wget with proxychains.

How do I set a wget proxy permanently?

Add use_proxy = on with http_proxy and https_proxy (and proxy_user / proxy_password) to ~/.wgetrc. Every wget run then uses the proxy automatically until you change the file.

How do I pass proxy credentials to wget?

Either inline in the proxy URL as http://USER:[email protected]:3128, or with the --proxy-user and --proxy-password flags, which keep the password out of the URL.

How do I stop wget using the proxy for some hosts?

Set the no_proxy environment variable (a comma-separated host list) or pass --no-proxy on a single command to bypass the proxy for internal or local addresses.

Proxy your downloads

Point wget at the authenticated HTTP endpoint on proxy.s4m.online:3128 and mirror, fetch and script behind a hidden datacenter exit. Metered pay-as-you-go, dedicated IP optional.

People found this page by searching for

Real search phrases this page answers — the linked ones open the page that covers them in depth.