Menu
User

DropVPS Team

Writer: John hens

how to set proxy in Debain 13 command line

how to set proxy in Debain 13 command line

Publication Date

11/10/2025

Category

Articles

Reading Time

2 Min

Table of Contents

Setting a proxy in Debian 13 via the command line allows you to route your system and application traffic through a proxy server for security, privacy, or access control. 

Step 1: Set a Temporary Proxy

A temporary proxy affects only the current terminal session. It’s useful for testing or short-term tasks. You can set HTTP, HTTPS, and FTP proxies as follows:

export http_proxy="http://username:password@proxyserver:port"
export https_proxy="https://username:password@proxyserver:port"
export ftp_proxy="ftp://username:password@proxyserver:port"
export no_proxy="localhost,127.0.0.1,::1"

Step 2: Set a Permanent Proxy

To make the proxy settings permanent across all sessions and users, add them to /etc/environment. This ensures that all applications and system processes use the proxy automatically.

sudo nano /etc/environment
# Add the following lines:
http_proxy="http://username:password@proxyserver:port"
https_proxy="https://username:password@proxyserver:port"
ftp_proxy="ftp://username:password@proxyserver:port"
no_proxy="localhost,127.0.0.1,::1"

After saving, reload the environment:

source /etc/environment

Step 3: Configure Proxy for APT

APT commands like apt update and apt install require a separate configuration to use the proxy. Create a file in /etc/apt/apt.conf.d/ with the proxy settings:

sudo nano /etc/apt/apt.conf.d/95proxies
# Add the following lines:
Acquire::http::Proxy "http://username:password@proxyserver:port/";
Acquire::https::Proxy "https://username:password@proxyserver:port/";

Step 4: Verify Proxy Settings

After configuring the proxy, check that it works correctly for both system and application commands. This ensures that all traffic is routed properly through your proxy server.

echo $http_proxy
curl -I http://example.com
wget --spider http://example.com

Step 5: Verify Proxy Settings

After configuring the proxy, check that it works correctly for both system and application commands. This ensures that all traffic is routed properly through your proxy server.

echo $http_proxy
curl -I http://example.com
wget --spider http://example.com

Step 6: Remove or Disable Proxy

If you need to remove or disable the proxy, either temporarily or permanently, use the following commands. This restores normal network behavior without routing through the proxy:

unset http_proxy
unset https_proxy
unset ftp_proxy
unset no_proxy

 

Linux VPS
U
Loading...

Related Posts

how to set proxy in Debain 13 command line