How to use Proxies with sudo

So that later they don't say that I like to spend work, yesterday I settled in Yogurt to later install Plank, the project dock ElementaryOS, but before it got to this, a problem presented itself to me.

It turns out that when adding the repositories AUR de and run:

$ sudo pacman -Syu

I could not update because I could not find the server. The point is that I am below quite a few proxy servers and sudo by default does not use connection variables for them. How to solve this?

The first thing is to add to the file .bashrc the global variables of proxies:

export http_proxy = "http: // my_proxy_server: 3128" export https_proxy = "http: // my_proxy_server: 3128" export ftp_proxy = "http: // my_proxy_server: 3128"

Once the variables have been added, we close the file and execute:

$ . .bashrc

In this way the variables and options of that file are loaded. Now what we have left is to add to the file / Etc / sudoers following:

Defaults env_keep + = "http_proxy" Defaults env_keep + = "https_proxy" Defaults env_keep + = "ftp_proxy"

Ready. We save the file and we can now use proxies with sudo.

The content of the article adheres to our principles of editorial ethics. To report an error click here!.

21 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.   Javierdebian said

    Replace the lines in ~ / .bashrc with the following:

    export http_proxy = http: // my_proxy_server: 3128
    export https_proxy = $ {http_proxy}
    export ftp_proxy = $ {http_proxy}

    In this way, by editing only the first line, we modify all of them.

    1.    elav said

      Oh! Great tip .. Thanks

  2.   msx said

    Bizarre !!!
    This is the magic of GNU + Linux unknown on other platforms (perhaps with the exception of Android), but: why Plank and not something more useful like Cairo Dock? Or something hyper light, like a KDE SC own panel or similar plasmoid !?
    Plank is very limited although eOS from what I see is improving day by day - the last addition was several improvements to the Wingpanel Slim, totally welcome.

    1.    Joseca said

      I would add to Wbar that it is super light and pseudo-transparencies are the best for a light environment such as Openbox. KDE is not exactly characterized by being something "hyper light"
      a greeting

      1.    msx said

        Not clear, KDE is only _light_ and whoever says otherwise is because it did not test at least the 4.10 branch - and that according to those who migrated to 4.11 say it is 300% faster and more fluid.
        In short, KDE is heavy, it is BS of the one who never used it, although of course, it cannot be compared with Openbox, which is only a window manager and ... nothing more, everything you want must be added to the mitt and hey ... the system is heavier, little by little, that is, as you add functionality with software that is very difficult to connect with each other - unlike in KDE, GNOME or Xfce environments that use internal messaging systems and common libraries for various functions to achieve coding consistency between different applications.

        Also, elav is a very tasteful cool guy who uses Arch Linux + KDE SC (Arch itself is blazing fast and light, go ahead and try). In this context it is indeed much lighter to use your own KDE panel or similar plasmoid to simulate a dock bar.

        Anyway, I had forgotten about wbar, which is true, it is fantastic, very light, with many effects and very configurable.
        Although: Openbox + Tint2 (a panel is needed after all) + Wbar + Wicd / NetworkManager applet + conky? (many use it) + some extra applet that you always need to have running we have a system managed with Openbox but almost the same weight (or the same !?) as LXDE / QT but without the homogeneous integration that a desktop provides in contrast to a manager of windows.

        Obviously it all comes down to personal taste, specific needs, purpose of use of the system, way of using the device in question, etc.


        1.    Joseca said

          KDE is not as heavy as many people think, I have tried it and I cannot say that it is heavy but the load of Openbox + Tint2 + Conky + Wbar + Wicd will be instantaneous and put you to work… There is nothing like that feeling. Nor can we compare ourselves to Elav which, from what I see, has good taste in refining KDE and I do not have it and therefore, apart from its extensive KDE configuration, which, in my own experience, is difficult, not counting the « Misconfigurations »that I accidentally cause make an environment like KDE out of my preferences. I'm looking for something more minimalist, but it's a matter of taste.
          A pleasure 😀

          1.    msx said

            @Joseca: it's true, what you say about "instant loading" is like WOW !, in a blink you have the system loaded.

            Still, I can't complain: there are few times that I restart - my last uptime was 23 days - and much less that I log out.
            So after those first interminable seconds when KDE starts everything goes very smooth!

        2.    cat said

          My KDE 3.11 consumes about 360 MB with nothing open.

    2.    elav said

      Very simple. Cairo-Dock is too heavy and has too many things that I don't use. Plank is lighter, simpler, and does just what I need. I have always liked this dock over any other.

      The KDE Panel is not bad, I have used it quite a bit, but it is missing some things like Dock, but I repeat, it is very good.

      1.    msx said

        [OT big, huge, if it prospers I face for the forum]
        @elav: you who are using Arch, if you have the time and you feel like it and you like the idea, of course, you dare to try installing a complete eOS environment to see if it is already possible or failing that, what is it? it is missing?

        I extend the request to all archers with time and who also like eOS.

        I think the most important obstacle to porting eOS to other distributions are the base packages that are used since Precise libraries are not exactly the ones used by Arch today. What's more: a complete eOS environment could become installable in Arch sometime ?

        If today eOS can be installed on Arch, it would be interesting to make an ISO with eOS pre-installed (and some more things like codecs and toolz necessary for a good OOTB experience), what do they say! ^ ^

        1.    msx said

          ERRATA: «could» !? Shiit xD

        2.    elav said

          It would take a lot of time and a good connection to be able to do that. However, I show you my eOS, look how cool:


          1.    msx said

            KDE rulez !!!

          2.    eliotime3000 said

            Can I also configure KDE to look like GNOME 3 Fallback?

            I didn't even realize the level of customization that KDE has.

  3.   Blitzkrieg said

    I was never able to install Plank from Arch, it gave me an error

    1.    elav said

      With Yaourt it is very easy:

      $ yaourt -S plank-bzr

  4.   Santiago Burgos said

    One question: And will it be possible to use this trick in other distros (Ubuntu, Mint, Fedora, etc) or is it only possible in Arch? That perhaps we would save ourselves from fighting because we cannot install something in places with a proxy, my university for example uses it a lot and it always costs me to install something because of that dirty proxy ¬_¬

    1.    elav said

      It works for any GNU / Linux distribution 🙂

  5.   scorponox said

    In my previous job I was behind a proxy. What I did was set pacman to use wget instead of curl and set wget (/ etc / wgetrc) with my proxy. To enable and disable it, I just changed the line from "proxy = on" to proxy = off "in / etc / wgetrc.


    1.    elav said

      Yes, it is also a way, but in this case it is to use ANY application that needs proxy with sudo 😀

  6.   Leper_Ivan said

    It will be useful for me to update my system when I am in the university ...