Adding system-wide proxy settings through environment variable in Linux

Proxy server is a device at the edge of a private network which relays the Internet traffic to and back from the Internet. It hides the private network from being directly communicated over the Internet adding a layer of security and privacy. It also acts as a content filter controlling the type of web sites the employees are allowed to visit and blocking the inappropriate and malicious ones.

In order to communicate through the Internet the Linux system needs proxy settings telling the location of proxy server and its listening port along with authentication credentials if they are set. In order to that add the http_proxy, https_proxy, ftp_proxy, socks_proxy environment variables to /etc/environment file.

The syntax to be followed is


No need to escape the metacharacters(*!^$.@) if they’re in your password as the environment variables are not interpreted by the shell but are directly read from the file.

Here’s what my /etc/environment looks like

deepak@linux:~$ cat /etc/environment 

Now enforce the new environment variables and make them permanent using source command which reads the file specified and executes what’s inside them.

deepak@linux:~$ source /etc/environment

Verify the proxy settings using echo command:

deepak@linux:~$ echo $http_proxy

About Deepak Devanand

Seeker of knowledge
This entry was posted in Linux and tagged . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s