How to use a proxy on the command line?
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?
- username: 1234
- pass: linux
- proxy: proxy
- port: 8080
The general scheme for the proxy URL is user:[email protected]:port
You can set the environment variable
In a bash shell, type this:
export http_proxy="http://user:[email protected]: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
When I try to wget something it connects to the proxy server but then gets a 407 a says I need authentication
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
If you did add that line to any of those files, you can unset your proxy by removing the same from them.
To set Network proxy settings one can use
gsettingschanges 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
gsettings set org.gnome.system.proxy.http host '' gsettings set org.gnome.system.proxy.http port 0 gsettings set org.gnome.system.proxy.http host '' gsettings set org.gnome.system.proxy.http 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'
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