Skip to content
Get Started
G2G2
4.7/5
Excellent
Trustpilot

How to set up a proxy on Linux

On Linux, set the proxy with environment variables: export https_proxy=http://USERNAME:PASSWORD@HOST:PORT and the same for http_proxy. Add them to /etc/environment to make them permanent, and give apt its own line in /etc/apt/apt.conf.d/. On Ubuntu desktop, Settings → Network → Network Proxy covers GNOME apps.

  • Session Control
  • High Speed
  • Privacy First

What you need

Linux has no single proxy switch: command-line tools read environment variables, apt has its own config, and the desktop has a GNOME setting. Set the layers you need and the server or workstation leaves from a dedicated CleanProxies static ISP IP, which suits long scraping jobs on unlimited bandwidth.

Your credential line

From the dashboard's proxy manager: host (or IP), port, username and password. Convert lists with the proxy list formatter.

Linux ready

  • A shell (bash or zsh) and sudo rights for system-wide settings.
  • curl to test the connection: curl --version.

Which proxy fits Linux?

Both products use the same setup in Linux. What changes is how long an IP stays with you.

A dedicated US ISP IP with unlimited bandwidth and threads, the same address all month: right for servers and long jobs. Whitelist the server's public IP and drop the credentials from every URL, or use SOCKS5 with socks5h://.

starting from$0.75/IP

Dedicated static IPs registered to US and Canadian ISPs. The address stays the same for as long as you hold it, with unlimited bandwidth and HTTP(S) or SOCKS5 access.

Put a rotating residential line in the variables for a new IP per connection, or a sticky line (5 to 60 minutes or 24 hours) when a job keeps a session. Residential is HTTP(S) with username and password only.

starting from$0.63/GB

Residential IPs in 190+ countries with country, state and city targeting. Rotate on every request or hold a sticky session for up to 90 minutes; GB never expire.

credentials

Your CleanProxies credentials

Every product connects over HTTP(S); static ISP and ISP subnet proxies also run SOCKS5 and IP whitelisting. This is what the dashboard gives you to paste into Linux.

Static ISP and ISP subnetHTTP(S)SOCKS5IP whitelist
IP:PORT:USER:PASS

One line per dedicated IP. With IP whitelisting on, the line is just IP:PORT and no password is sent.

Rotating residential and mobileHTTP(S)User:pass
HOST:PORT:USER:PASS

Generated in the proxy manager. The username carries the location and session you pick, so generate a new list to change them.

As a URL, for code and most toolshttp://USERNAME:PASSWORD@HOST:PORTsocks5://USERNAME:PASSWORD@HOST:PORT

Use http:// even for HTTPS websites; the TLS session still runs end to end. The socks5:// form is for static ISP and ISP subnet proxies.

How to set up CleanProxies in Linux

Four steps, then check the exit IP with the free proxy checker.

  1. 1

    Export the variables

    In your shell run export https_proxy=http://USERNAME:PASSWORD@HOST:PORT and export http_proxy= with the same URL, plus the uppercase HTTPS_PROXY and HTTP_PROXY, because tools differ in which case they read.

  2. 2

    Test it

    Run curl -s https://api.ipify.org. The address printed should be your CleanProxies IP.

  3. 3

    Make it permanent

    Add the lines to ~/.bashrc (or ~/.zshrc) for your user, or to /etc/environment for every user; the latter applies at the next login.

  4. 4

    Cover apt and the desktop

    apt reads its own Acquire::http::Proxy line. On Ubuntu desktop, open Settings → Network → Network Proxy, choose Manual and enter the host and port for GNOME apps.

copy & paste

Linux proxy examples

Replace the highlighted placeholders with the values from your dashboard. Pick an example to see its code.

Linux + CleanProxies

Proxy environment variables

Set both cases: curl reads only lowercase http_proxy (and either case for the others), while some other tools read only uppercase. no_proxy lists hosts that go direct, separated by commas.

Current shell or ~/.bashrcShell
export http_proxy="http://USERNAME:PASSWORD@HOST:PORT"
export https_proxy="$http_proxy"
export HTTP_PROXY="$http_proxy"
export HTTPS_PROXY="$http_proxy"
export no_proxy="localhost,127.0.0.1"
export NO_PROXY="$no_proxy"

curl -s https://api.ipify.org
  • /etc/environment is not a shell script: one KEY=value per line, no export and no $variables. Percent-encode @ or : in a password (@ becomes %40). With an ISP proxy on SOCKS5, socks5h://USERNAME:PASSWORD@HOST:PORT works for curl and other tools that support it.

Which tools read what

  • Environment variables: curl, wget, pip, Git, Python Requests and most CLI tools. Node.js fetch and many compiled programs don't read them by default.
  • GNOME Network Proxy (Settings → Network → Network Proxy → Manual): GNOME apps and Chrome on the desktop. It has no username or password fields, so it suits ISP proxies with your public IP whitelisted.
  • apt: its own config file (above). Docker builds and the Docker daemon use separate settings too.
  • UDP traffic isn't proxied: CleanProxies carries TCP only.
fix it fast

Troubleshooting Linux proxy errors

Verify your exit IP

Run the command below with the variables set, then once with env -u http_proxy -u https_proxy -u HTTP_PROXY -u HTTPS_PROXY in front of it. The first prints your CleanProxies IP, the second your own.

Open What is my IP? through the proxy to see the address and headers a website receives, or paste up to ten lines into the free proxy checker to test connectivity, latency and exit IP.

Still stuck? Our 24/7 support team answers fast: contact us with the error and the line you used (leave the password out).

Linux error fixes
  • curl ignores the proxyWhy: Only uppercase HTTP_PROXY is set, which curl doesn't read for http:// URLs.Set lowercase http_proxy and https_proxy as well.
  • `sudo` commands go directWhy: sudo resets the environment by default.Use sudo -E, put the lines in /etc/environment, or configure the tool (apt, Docker) with its own proxy setting.
  • 407 Proxy Authentication RequiredWhy: A special character in the password breaks the URL, or the username is wrong.Percent-encode @, : and # in the password, or whitelist your IP on an ISP proxy and use http://IP:PORT.
  • New variables don't applyWhy: /etc/environment and ~/.bashrc are read at login or when a shell starts.Log out and in again, or open a new terminal (source ~/.bashrc for the current one).

Linux proxy guides

Setup guides and best practices from the CleanProxies blog.

Get the latest insightsAll Blogs

More integrations

Setup guides for tools people run next to Linux.

Proxies for sites people reach with Linux
All integrations

Linux proxy FAQs

Straight answers about running CleanProxies in Linux.

On the desktop, open Settings, Network, Network Proxy and choose Manual. For the terminal and servers, export http_proxy and https_proxy in your shell or add them to /etc/environment, and give apt its own Acquire::http::Proxy line.

Got more questions?All FAQs