If you are working on Linux and need to route traffic through a proxy — for scraping, monitoring prices on marketplaces, or managing multiple accounts — standard instructions from the internet often do not work. Some describe only the browser, others only the terminal, and there is no complete picture anywhere. In this guide, we will cover all methods: from a single command in the terminal to system settings that cover all traffic on Ubuntu and Debian.
Which type of proxy to choose for Linux
Before proceeding to the setup, it is important to understand: not all proxies are equally suitable for different tasks. Linux machines are often used for automated tasks — scraping, monitoring, mass requests — and the choice of proxy type is critical here.
| Proxy Type | Protocols | Suitable for | Risk of Blocking |
|---|---|---|---|
| Datacenter Proxies | HTTP, HTTPS, SOCKS5 | Scraping, curl, scripts | Medium |
| Residential Proxies | HTTP, HTTPS, SOCKS5 | Marketplaces, social networks, accounts | Low |
| Mobile Proxies | HTTP, SOCKS5 | Facebook, Instagram, TikTok | Minimal |
For most tasks on Linux, HTTP/HTTPS or SOCKS5 proxies will suffice. SOCKS5 is preferable — it operates at the TCP level and is supported by most tools, including curl, wget, and proxychains. In all examples below, we will use both options.
Proxy Data Format
For all settings below, you will need data in the format:
host:port or host:port:login:password
This data is provided by your proxy provider in your personal account.
Setting up via environment variables in the terminal
The quickest way to route traffic through a proxy in Linux is to set environment variables. Most console utilities (curl, wget, pip, apt, and others) automatically read these variables and use the specified proxy without additional configuration.
Temporary Setup (only for the current session)
Open the terminal and execute the following commands. Replace the values with your proxy data:
# For HTTP proxy without authentication export http_proxy="http://192.168.1.1:3128" export https_proxy="http://192.168.1.1:3128" # For HTTP proxy with login and password export http_proxy="http://login:[email protected]:3128" export https_proxy="http://login:[email protected]:3128" # For SOCKS5 proxy export http_proxy="socks5://login:[email protected]:1080" export https_proxy="socks5://login:[email protected]:1080" # Exceptions — addresses without proxy (localhost and local network) export no_proxy="localhost,127.0.0.1,::1,192.168.0.0/16"
After these commands, all utilities in the current terminal will use the proxy. An important nuance: some programs read variables only in uppercase. To be safe, duplicate the commands with capital letters:
export HTTP_PROXY="http://login:[email protected]:3128" export HTTPS_PROXY="http://login:[email protected]:3128" export NO_PROXY="localhost,127.0.0.1"
Permanent Setup for Your User
To have the proxy applied automatically each time you log into the terminal, add the variables to the ~/.bashrc file (for bash) or ~/.zshrc (for zsh):
# Open the file in the nano editor nano ~/.bashrc # Add the following lines at the end of the file: export http_proxy="http://login:password@host:port" export https_proxy="http://login:password@host:port" export HTTP_PROXY="http://login:password@host:port" export HTTPS_PROXY="http://login:password@host:port" export no_proxy="localhost,127.0.0.1" # Save: Ctrl+O, Enter, Ctrl+X # Apply changes without restarting the terminal: source ~/.bashrc
System Setup for All Users
If Linux is used as a server or you want to apply the proxy for all users of the system, add the variables to the /etc/environment file:
sudo nano /etc/environment # Add the lines (without the export command!): http_proxy="http://login:password@host:port" https_proxy="http://login:password@host:port" HTTP_PROXY="http://login:password@host:port" HTTPS_PROXY="http://login:password@host:port" no_proxy="localhost,127.0.0.1,::1"
After saving the file, the changes will take effect at the next login. To apply without rebooting, execute source /etc/environment.
System Proxy Settings via Graphical Interface (GNOME)
If you are using Ubuntu with the GNOME desktop (standard Ubuntu Desktop installation), you can set up the proxy through the graphical interface without a single command. This is convenient for those who are just starting to work with Linux.
Step-by-Step Instructions for Ubuntu GNOME
- Click on the icon in the upper right corner of the screen → select “Settings”
- In the left menu, scroll down and select “Network”
- In the “Network Proxy” section, click the button with the arrow (settings icon)
- Select the proxy mode:
- Disabled — proxy is not used
- Manual — you enter the proxy data yourself (recommended)
- Automatically — a PAC file from the provider is used
- Select “Manual” and fill in the fields:
- HTTP Proxy: enter the host address and port
- HTTPS Proxy: the same data
- SOCKS Host: address and port (if using SOCKS5)
- Ignore hosts:
localhost, 127.0.0.0/8
- Close the window — the settings are applied automatically
⚠️ Important to Know
Proxy settings through GNOME apply only to applications that read system settings: GNOME Web browser, some GNOME applications. Terminal utilities (curl, wget, apt) do not use these settings — they require environment variables from the previous section. Firefox and Chromium have their own proxy settings.
Setting via gsettings (terminal + GUI)
If you want to manage GNOME system proxy settings through the terminal (for example, for automation), use the gsettings command:
# Enable manual proxy mode gsettings set org.gnome.system.proxy mode 'manual' # Set HTTP proxy gsettings set org.gnome.system.proxy.http host 'host' gsettings set org.gnome.system.proxy.http port 3128 # Set HTTPS proxy gsettings set org.gnome.system.proxy.https host 'host' gsettings set org.gnome.system.proxy.https port 3128 # Set SOCKS5 proxy gsettings set org.gnome.system.proxy.socks host 'host' gsettings set org.gnome.system.proxy.socks port 1080 # Disable proxy gsettings set org.gnome.system.proxy mode 'none'
Proxy for APT — Installing Packages via Proxy
The APT package manager (used in Ubuntu and Debian) has its own proxy setup system that does not depend on environment variables. This is especially relevant for servers without direct internet access or for corporate networks.
Method 1: Temporary Proxy for One Command
# Use proxy for one apt command sudo apt-get -o Acquire::http::Proxy="http://login:password@host:port" update # Or via environment variable sudo http_proxy="http://login:password@host:port" apt-get update
Method 2: Permanent Proxy for APT
Create a configuration file for APT. This method is recommended for servers where the proxy is needed constantly:
# Create the configuration file sudo nano /etc/apt/apt.conf.d/95proxies # Add the content: Acquire::http::Proxy "http://login:password@host:port"; Acquire::https::Proxy "http://login:password@host:port"; Acquire::ftp::Proxy "ftp://login:password@host:port"; # Save and check: sudo apt-get update
If the proxy is without authentication, the lines look simpler: Acquire::http::Proxy "http://host:port";. To disable the proxy for APT, simply delete the created file with the command sudo rm /etc/apt/apt.conf.d/95proxies.
Proxy for curl and wget
Curl and wget are the main tools for working with HTTP requests in Linux. They are used for scraping, testing APIs, downloading files. Both tools support proxies directly through command line parameters.
Curl with Proxy
# HTTP proxy curl -x http://login:password@host:port https://example.com # SOCKS5 proxy curl --socks5 host:port --proxy-user login:password https://example.com # Check your IP through the proxy curl -x http://login:password@host:port https://api.ipify.org # Ignore SSL errors (if needed) curl -x http://login:password@host:port -k https://example.com
To avoid specifying the proxy each time, add the setting to the ~/.curlrc file:
nano ~/.curlrc # Add the line: proxy = "http://login:password@host:port" # Now curl always uses this proxy: curl https://api.ipify.org
Wget with Proxy
# Via command line parameter wget -e "http_proxy=http://login:password@host:port" https://example.com # Permanent setup in ~/.wgetrc nano ~/.wgetrc # Add the lines: http_proxy = http://login:password@host:port https_proxy = http://login:password@host:port use_proxy = on
Proxy for Firefox and Chromium on Linux
Browsers on Linux have their own proxy settings that work independently of system settings. This is convenient if you want to use a proxy only in the browser without affecting the rest of the traffic.
Firefox: Manual Setup
- Open Firefox → click on the three stripes in the upper right corner → “Settings”
- Scroll down to the “Proxy Server” section → click “Settings”
- Select “Manual proxy configuration”
- Fill in the fields:
- HTTP Proxy: host address, port
- Check the box “Use this proxy server for all protocols”
- Or specify SOCKS separately: address, port, select SOCKS v5
- Click OK
If the proxy requires authentication, Firefox will prompt for a username and password the first time you connect and will remember them. For quick switching between multiple proxies, install the FoxyProxy extension — it allows you to create profiles and switch with one click.
Chromium / Google Chrome: Launching with Proxy
Chromium on Linux does not have built-in proxy settings in the interface — it uses system settings. However, you can launch the browser with a specific proxy via command line parameter:
# Launch Chromium with HTTP proxy chromium-browser --proxy-server="http://host:port" # Launch with SOCKS5 proxy chromium-browser --proxy-server="socks5://host:port" # Launch with proxy and ignoring localhost chromium-browser --proxy-server="http://host:port" \ --proxy-bypass-list="localhost;127.0.0.1" # For Google Chrome, replace chromium-browser with google-chrome google-chrome --proxy-server="socks5://host:port"
💡 Tip for Multi-Account Management
If you manage multiple accounts through a browser on Linux, using a regular browser with a proxy is not enough — sites track browser fingerprints, cookies, and other parameters. For full multi-accounting, use anti-detect browsers: Dolphin Anty, AdsPower, or GoLogin — they create isolated profiles with separate proxies for each account.
Proxychains — Proxy for Any Application Without Support
Some applications do not support proxy settings either through environment variables or their own parameters. In this case, proxychains comes to the rescue — a tool that intercepts network calls from any program and routes them through a proxy. This is especially useful for parsers written in Python or specialized utilities.
Installing Proxychains
# Ubuntu / Debian sudo apt-get update sudo apt-get install proxychains4 # Check installation proxychains4 --version
Configuring the Configuration File
# Open the config sudo nano /etc/proxychains4.conf # Find the line "dynamic_chain" — uncomment it (remove #): dynamic_chain # Comment out "strict_chain" (add # at the beginning): # strict_chain # At the end of the file in the [ProxyList] section, add our proxy: # Format: type host port [login] [password] # HTTP proxy without authentication: http 192.168.1.1 3128 # SOCKS5 with authentication: socks5 host 1080 login password
Using Proxychains
After configuration, simply add proxychains4 before any command:
# Run curl through proxy proxychains4 curl https://api.ipify.org # Run Python script through proxy proxychains4 python3 parser.py # Run nmap through proxy proxychains4 nmap -sT target.com # Open Firefox through proxy proxychains4 firefox
The dynamic_chain mode means that if one proxy is unavailable, proxychains will try the next one in the list. This is convenient if you have multiple proxies — add them all to the [ProxyList] and get automatic rotation.
How to Check if the Proxy is Working
After setup, be sure to check that the traffic is indeed going through the proxy and not directly. Here are a few quick ways:
Check via curl
# Find out the current IP without proxy curl https://api.ipify.org # Result: your real IP, for example, 85.12.34.56 # Find out IP through the proxy curl -x http://login:password@host:port https://api.ipify.org # The result should differ — this is the IP of the proxy server # Extended information about IP curl -x http://login:password@host:port https://ipinfo.io/json
Check Environment Variables
# View the set proxy variables env | grep -i proxy # Expected result: # http_proxy=http://login:password@host:port # https_proxy=http://login:password@host:port
Check Proxy Server Availability
# Check that the proxy port is open and responding nc -zv host port # For example: nc -zv 192.168.1.1 3128 # If nc is not installed: telnet host port
✅ Proxy Check Checklist
- The IP in the curl response differs from your real IP
- The country and city in ipinfo.io correspond to the selected proxy
- No errors
Connection refusedor407 Proxy Authentication Required - Connection speed is acceptable (check via curl with the flag
-w "%{time_total}")
Practical Scenarios: Scraping, Monitoring, Multi-Accounting
Let's consider specific tasks that users often face when setting up proxies on Linux.
Scenario 1: Scraping Wildberries and Ozon from a Linux Server
Marketplace sellers often run price scrapers on VPS with Ubuntu. Wildberries and Ozon actively block requests from server IP addresses. To bypass this protection, residential proxies are needed — they appear as regular home users.
The recommended setup scheme for scraping marketplaces:
- Set environment variables with data from residential proxies in the
~/.bashrcfile - If using a Python script — ensure that the
requestslibrary reads environment variables (it reads by default) - For IP rotation, configure several proxies in proxychains with
dynamic_chainmode - Add delays between requests (1-3 seconds) — this reduces the risk of blocking
- Check the IP after every 50-100 requests via
curl https://api.ipify.org
Scenario 2: Monitoring Competitor Prices on Avito
Avito blocks requests based on several criteria: request frequency, User-Agent type, IP address. To monitor ads from a Linux server, use the following approach:
# Example request to Avito through proxy with correct headers curl -x http://login:password@host:port \ -H "User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36" \ -H "Accept-Language: ru-RU,ru;q=0.9" \ -H "Accept: text/html,application/xhtml+xml" \ "https://www.avito.ru/moskva/nedvizhimost"
For Avito, it is especially important to use proxies with Russian IP addresses. Residential proxies with geolocation in the desired city allow you to see ads tied to a specific region.
Scenario 3: Working with Facebook Ads and Instagram via Linux
Arbitrageurs who work on Linux (often via VPS) use anti-detect browsers to manage advertising accounts. The workflow is as follows:
- Install Dolphin Anty or AdsPower on Linux (both have Linux versions)
- Create a separate browser profile for each Facebook Ads account
- In the settings of each profile, specify a separate proxy
- For Facebook and Instagram, mobile proxies are recommended — they have real IPs from mobile operators and minimal risk of blocks
- The system proxy on Linux is not needed — the anti-detect browser manages the proxy at the profile level
Comparison of Proxy Setup Methods on Linux
| Method | Coverage | Complexity | Best for |
|---|---|---|---|
| Environment Variables | Most CLI utilities | Low | Scripts, curl, pip |
| GNOME GUI | GNOME applications | Low | Desktop without terminal |
| APT Config | Only APT | Low | Servers behind NAT |
| Proxychains | Any application | Medium | Parsers, third-party utilities |
| Browser Settings | Only browser | Low | Manual work in the browser |
Common Mistakes When Setting Up Proxies on Linux
- Only lowercase variables — some programs read only
HTTP_PROXY(uppercase), others — onlyhttp_proxy. Set both options. - Forgot to source — after modifying
.bashrc, you need to executesource ~/.bashrc, otherwise the changes will not apply. - Proxy does not work with sudo — when using sudo, user environment variables are not passed. Use
sudo -Eto pass the variables. - localhost goes through the proxy — always add the values
localhost,127.0.0.1tono_proxy. - Incorrect URL format — for HTTP proxies, always specify the scheme:
http://orsocks5://.
Conclusion
Setting up a proxy on Linux Ubuntu and Debian is a task that can be solved in several ways depending on your goal. For most tasks, environment variables are sufficient: they cover curl, wget, pip, and most scripts. For complete coverage of traffic from any application, use proxychains. For browsers — built-in settings or launching with the --proxy-server parameter. For APT — a separate configuration file.
The main principle: choose the method for a specific task. There is no need to set up a system proxy if you only need a proxy for one script. Conversely — if all server traffic should go through a proxy, set the variables in /etc/environment once and forget about it.
If you use Linux for scraping marketplaces, monitoring prices, or automated requests, pay attention to residential proxies — they have real IPs of home users, which are hardly blocked on Wildberries, Ozon, and Avito. For working with advertising accounts on Facebook Ads and Instagram through anti-detect browsers on Linux, mobile proxies are well-suited — minimal risk of blocks and maximum trust from the platforms.