How to Set a Proxy for Terminal?
I Am Looking to Set a Proxy for Terminal. What I Need Is I Want to Send All Terminal Communications to the Internet Through a Proxy, Say Tor. I Tried to Set a...
I am looking to set a proxy for terminal. What I need is I want to send all terminal communications to the internet through a proxy, say tor.
I tried to set a system wide proxy set up. But Terminal doesn't obey the system wide proxy configuration.
Is there any other way to do this?
6 Answers
export the below variables in terminal
export http_proxy='
export https_proxy='
and use the following commands to disable proxy
unset http_proxy
unset https_proxy
Terminal is not net application. Maybe is better to say, in your case, terminal is container for net application like ssh, telnet, lftp, wget, lynx ...
Edit your:
sudo -H gedit /etc/profile.d/proxy.sh
Enter the details in this format.
export http_proxy=
export ftp_proxy=
export telnet_proxy=
This is for when using wget, ftp, lftp, telnet in terminal
ssh has no native SOCKS client support, you need to use a ProxyCommand for that, for instance with socat:
ssh -o ProxyCommand='socat - SOCKS4A:myproxy:%h:%p,socksuser=nobody' user@host
Or use things like tsocks to transparently use SOCKS for TCP traffic.
For SOCKS5 with socat 2:
ssh -o ProxyCommand='socat - "SOCKS5:%h:%p|tcp:myproxy:1080"' user@host
For HTTP Proxy CONNECT method with socat 2:
ssh -o ProxyCommand='socat - "PROXY:%h:%p|tcp:myproxy:80"' user@host
In my case I was either missing enclosing inverted comma on both sides.
putting "http//.." was wrong and not putting anything such as http//... was wrong too. What worked was ..when I used single inverted commas on both sides.
export http_proxy='
export https_proxy='
export ftp_proxy='
Remember these three are 3 commands to be run separately three times.
I set export variables
export http_proxy=
export https_proxy=
export ftp_proxy=
in ~/.bashrc and /etc/enviroment
using torsocks this can be accomplished like so:
ultralazer@askubuntu:~$ torsocks --shell
New torified shell coming right up...
ultralazer@askubuntu:~$ curl icanhazip.com
185.220.100.242 (tor ip)
man page:
ultralazer@askubuntu:~$ torsocks --help
ultralazer@askubuntu:~$ man torsocks
From my research this was the only thing that worked for me:
Install ProxyChains:
sudo apt-get install proxychains
Edit the conf file to use your proxy:
sudo vi /etc/proxychains.conf
Check the last line and edit it. Then just run:
proxychains ssh/curl/wget
or whatever command you want to go through the proxy.