Use proxy in Openbox, Fluxbox, LXDE, Xfce and similar

The method I describe below was obtained by translating an article into Spanish on Arch Wiki about using a proxy. This method must be perfectly valid for any other distribution.

Desktop Environments like Xfce o LXDE lack any application that allows them to manage the use of a Global Proxy in the System, in the way we can do it in Gnome o KDE.

Environment variables

Some programs (like wget) use environment variables of the form "protocol_proxy" to determine the representation of a certain protocol (for example, HTTP, FTP, ...).

Here is an example of how to set these variables:

export http_proxy=http://192.168.1.3:3128/
export https_proxy=http://192.168.1.3:3128/
export ftp_proxy=http://192.168.1.3:3128/
export no_proxy="localhost,127.0.0.1,localaddress,.localdomain.com"

If we want to make the aforementioned proxy environment variables available to all users, we can add script, for example "Proxy.sh"Within /etc/profile.d/. The script must have execute permissions.

# chmod +x /etc/profile.d/proxy.sh

Alternatively, you can automate the switching of variables by adding a function to your file .bashrc as follows:

function proxy(){
echo -n "username:"
read -e username
echo -n "password:"
read -es password
export http_proxy="http://$username:$password@proxyserver:8080/"
export https_proxy="http://$username:$password@proxyserver:8080/"
export ftp_proxy="http://$username:$password@proxyserver:8080/"
export no_proxy="localhost,127.0.0.1,localaddress,.localdomain.com"
echo -e "\nProxy environment variable set."
}
function proxyoff(){
unset HTTP_PROXY
unset http_proxy
unset HTTPS_PROXY
unset https_proxy
unset FTP_PROXY
unset ftp_proxy
echo -e "\nProxy environment variable removed."
}


10 comments, leave yours

Leave a Comment

Your email address will not be published. Required fields are marked with *

*

*

  1. Responsible for the data: Miguel Ángel Gatón
  2. Purpose of the data: Control SPAM, comment management.
  3. Legitimation: Your consent
  4. Communication of the data: The data will not be communicated to third parties except by legal obligation.
  5. Data storage: Database hosted by Occentus Networks (EU)
  6. Rights: At any time you can limit, recover and delete your information.

  1.   ren said

    the truth I have never used a proxy for what is it?

    1.    elav <° Linux said

      Well ... A proxy has many uses. A proxy serves to intercept network connections that a client makes to a destination server. What's up, as I was saying, it has many uses. Let's see how I explain you in a simple way:

      a) Let's say that on your company's PC you browse through a Proxy. If it has the cache function and you enter, for example, desdelinux.net, all the information you receive will be saved in its cache. Then, when you access it again at another time, access will be a little faster because you will have some items in said cache.

      b) Let's say you connect from a PC in your company and you want to access desdelinux.net. That PC, when you go to browse, makes the request to your company's Proxy Server and depending on the restrictions you have, this server sends your request to the Internet or rejects it.

      These are two typical cases. A proxy server can be something or very good, or very very very bad (as in my case).

      For more information see this link.

      1.    Courage said

        And it also works to circumvent filters, let's not forget

        1.    KZKG ^ Gaara <"Linux said

          That is another kind of proxy 🙂

  2.   arthur molina said

    I wanted to ask the author if, has he ever shared an internet connection via PAN (bluetooth)? I did it in win 7 and XP, in which I had the connection, I raised a proxy (perProxy made in java) and in the other machine through the PAN, I configured Firefox with the IP and port. When I switched to Linux, I no longer knew how to do a PAN between machines.

  3.   Ariel said

    Hello, good afternoon,
    I am a happy Lubuntu user and I have run into the problem that I use my school's connection (with proxy) on a daily basis and my home connection as well (without proxy). Therefore, if I configure the system-wide proxy, I have to put it on and off it depending on whether I am in college or not.

    Is there a way to automate this process so that depending on the Wi-Fi network you connect to, it can be activated or not?

    A greeting.

    1.    KZKG ^ Gaara said

      Hello good afternoon 🙂
      How is it that you are setting the proxy for your system? By what command?

      I could program a script that detects the Wi-Fi you are connected to, and depending on which of these it is ... use a proxy or another.

      Greetings and welcome.

      1.    jerrykpg said

        Hello everyone! I have been working with LXDE for some time and, for a matter similar to Ariel's, I was forced to configure a proxy in order to connect to the Internet.
        I was going through the documentation on AskUbuntu and came across someone who asked something similar and the answer was very helpful! I leave the link in case someone is interested in looking at it: http://askubuntu.com/q/175172/260592
        And finally, I would like to know if KZKG ^ Gaara programmed the script that detects Wifi and changes the proxy depending on the network ... It would really be very useful if I decided to share it.

        Thank you very much and greetings!

  4.   SLACKER said

    Hi, I'm using slackware 14.1 and I did the part of the script right, what I didn't find on my system was the .bashrc file

  5.   Baphomet said

    This article is a bit old, but I'll write to you anyway because it seems to be the closest thing to MY problem:
    What should I do when my user has the USER @ COMPANY form? If you pay attention; Two arrobas will remain on the same line!