How to setup system wide proxy in kali Linux 2023

By rushcybertech

Introduction

In this guide, we will learn how to setup system wide proxy in Kali Linux, As well as On Ubuntu. Imagine you are in a local network environment where access to the Internet is also possible when you are going through a proxy server.

In my case, I Am using voucher-based wifi on my mobile So I thought why not connect my phone to use the Internet on my laptop? Am using a Netshare app that allows you to create a hotspot while you are connecting to wifi But there is one clash,I have to setup system wide proxy in kali linux to use the internet on my laptop.

Well, in this guide we will learn how to configure system-wide proxy settings on your Kali Linux server or desktop so that you can be able to access the Internet.

Setup System-Wide Proxy in Kali Linux

To set a system-wide proxy in Kali Linux is a pretty straightforward task. Let us see how we can do that by following steps.

Set System-Wide Proxy using Environment Variables

One of the ways of configuring system-wide proxy settings on Kali Linux system is by using environment variables especially if you are running a headless server. Proxy environment variables depend on the protocol handlers used by your proxy server. This can either be HTTP, HTTPS, FTP, or SOCKS.

Hence to set http or https proxy environment variables.

use the export command

export http_proxy=http://Your-Proxy-IP:Proxy-Port/

( In my case my proxy is 192.168.49.1:8282 But you have to put your own proxy IP and port In this field(Your-proxy-Ip) )

export https_proxy=https://Your-Proxy-IP:Proxy-Port/

Note that the export command sets temporarily environment variables that are only persistent on the shell you created the variable and the user who created the variable.

To set the proxy environment variables to apply to all the system users or persistent across all shells, you can append these lines to /etc/environment.

echo -e “http_proxy=http://Your-Proxy-IP:Proxy-Port/\nhttps_proxy=https://Your-Proxy-IP:Proxy-Port/” | sudo tee -a /etc/environment

It will return below 2 Lines that shows its successfully applied

http_proxy=http://Your-Proxy-IP:Proxy-Port/

https_proxy=https://Your-Proxy-IP:Proxy-Port/

How to setup proxy in kali linux

Note that these settings will only take effect on login again since the /etc/environment is read on system login.

To test this out, try to download anything from the terminal or restart your system. You will see that the connections is happening through the proxy server.

In my case I don’t need authentication So I cant give screenshot for that.

Configure Proxy if need authentication

If your proxy server requires username/password authentication, then the environment variables would set as below;

http_proxy=http://Username:Password@Your-Proxy-IP:Proxy-Port/

https_proxy=https://Username:Password@Your-Proxy-IP:Proxy-Port/

Configure Proxy Setup For APT Only

To configure proxy settings for APT only, you can simply create proxy configuration file under /etc/apt/apt.conf.d/.

echo -e ‘Acquire::http::Proxy “http://Your-Proxy-IP:Proxy-Port/”;\nAcquire::https::Proxy “https://Your-Proxy-IP:Proxy-Port/”;’ | sudo tee /etc/apt/apt.conf.d/02proxy

It will Again return below 2 Lines that shows its successfully applied

Acquire::http::Proxy “http://Your-Proxy-IP:Proxy-Port/”;

Acquire::https::Proxy “https://Your-Proxy-IP:Proxy-Port/”;

See Below Screenshot

If need authentication

For APT;

Acquire::http::Proxy “http://Username:Password@Your-Proxy-IP:Proxy-Port/”;Acquire::https::Proxy “https://Username:Password@Your-Proxy-IP:Proxy-Port/”;

For Single time use only

If you are looking at running at command for just that moment via proxy, you may prefix apt command with proxy settings as shown below;

sudo ‘http_proxy=http://Your-Proxy-IP:Proxy-Port’ apt update

or If it needs authentication use below command

sudo ‘http_proxy=http://Username:Password@Your-Proxy-IP:Proxy-Port’ apt update

This method is used on almost every linux distro with a little bit of changes including Ubuntu etc ,Hope these methods will help to solve your problem and you are enjoying internet on your system .

I always Upload tips and tutorials about cyber security and linux on my site. kindly comment and share this if you find it helpful.It motivates me to create more tutorials for you guys.

If you still face any issue you can contact on my social channels for personal assistance.

That is all about how to configure system wide proxy on Kali Linux. Enjoy.

Leave a Comment

Exit mobile version