How to Proxy Linux Traffic

Setup a HTTP, HTTPS or FTP proxy for your Linux cmd

When you are using Linux or more specifically, tools you have downloaded from GitHub. You might find yourself in the annoying situation where you need to proxy the tool to another computer.

For example, if you're using Kali Linux to run the tool but your Burp Suite is installed on Windows.

Well, here's the solution to your troubles

Session-Only Proxy

These 'export' commands will remain valid for the entire time you have the console open:

$ export http_proxy="http://PROXY_SERVER:PORT"
$ export https_proxy="https://PROXY_SERVER:PORT"
$ export ftp_proxy="http://PROXY_SERVER:PORT"

When you close your console, these will no longer be set.

Constant Proxy

If you need your proxy to be constantly running, these are the files you can use to set that:

/etc/bash.bashrc

export http_proxy=http://proxy.thegeekdiary.com:8080/
export ftp_proxy=http://proxy.thegeekdiary.com:8080/
https_proxy=http://proxy.thegeekdiary.com:8080/

/etc/apt/apt.conf

Acquire::http::Proxy "http://[proxy-server-ip-or-dns-name]:[Port-Number]";
Acquire::https::Proxy "http://[proxy-server-ip-or-dns-name]:[Port-Number]";
Acquire::ftp::Proxy "http://[proxy-server-ip-or-dns-name]:[Port-Number]";

Last updated