16

I can set my proxy username and password along with proxy settings in the proxy ui but these settings do not work on the command line. How can I use apps such as wget & ping on the command line with a proxy?

Example Details:

  • username: 1234
  • pass: linux
  • proxy: proxy
  • port: 8080
0

3 Answers 3

19

The general scheme for the proxy URL is user:password@host:port

You can set the environment variable http_proxy, https_proxy, ftp_proxy, socks_proxy or all_proxy

In a bash shell, type this:

export http_proxy="http://user:password@host:port"

To persist this configuration, you can add it to /etc/environment or /etc/bash.bashrc, /etc/profile or to an individual user /home/user/.bashrc

4
  • When I try to wget something it connects to the proxy server but then gets a 407 a says I need authentication
    – consindo
    Jun 8, 2011 at 0:32
  • wget should work using only the environment variable "http_proxy", but you can take a look at the link that @nitstorm posted. It says you can add proxy information to ~/.wgetrc
    – Alex
    Jun 8, 2011 at 20:37
  • If you did add that line to any of those files, you can unset your proxy by removing the same from them.
    – Prasanth
    Dec 29, 2012 at 18:15
  • 2
    It seems like a bad idea to add plaintext passwords into the command prompt, is this really the ideal solution?
    – weberc2
    Jul 22, 2015 at 13:04
1

To set Network proxy settings one can use gsettings

gsettings changes the configuation files at DConf, which is the core settings for Ubuntu network proxy settings that you see in GUI by going to Network > Network Proxy

Here is an example to set http, https and ftp proxy:

gsettings set org.gnome.system.proxy.http host ''
gsettings set org.gnome.system.proxy.http port 0
gsettings set org.gnome.system.proxy.https host ''
gsettings set org.gnome.system.proxy.https port 0
gsettings set org.gnome.system.proxy.ftp host ''
gsettings set org.gnome.system.proxy.ftp port 0

#Setting the Dynamic socks proxy 
gsettings set org.gnome.system.proxy.socks host 'localhost'
gsettings set org.gnome.system.proxy.socks port 1111

#Setting Mode 
gsettings set org.gnome.system.proxy mode 'manual'
0

You can't use proxies in the traditional sense with Ping. Ping works using the ICMP protocol.

HTTP proxies will only work with HTTP traffic. You can proxy most traffic in most programs using a SOCKSify-wrapper. The "dante-client" package provides a socksify. I used this one on other occasions: https://github.com/gr0gmint/transucks

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .