14

I am a beginner using linux, I would like to connecting the terminal to the local proxy socks made by my ssh (Dynamic Port Forwarding),

so is there a way to set up a proxy socks5 in the terminal?

or should use an additional module,

or have to go through another tool,

thank you for your attention

arifoxs
  • 141
  • 1
  • 1
  • 4

4 Answers4

19

I'm using Proxychains, an easy to use command line tool. Usage:

sudo proxychains4 apt-get update

You can configure you proxy in the /etc/proxychains.conf

[ProxyList]

socks5  127.0.0.1 12345
Zanna
  • 72,312
lumen
  • 505
16

Official use is:

ssh -D 8080 name@myserver.com

export http_proxy="socks5://127.0.0.1:8080" export https_proxy="socks5://127.0.0.1:8080"

no need to install anything.

Gabriel
  • 161
1

Proxychains is very nice tool, but there are certain use cases that it does not support. What that worked for me was graftcp based on this comment.

The installation is easy:

git clone https://github.com/hmgle/graftcp.git
cd graftcp
make

Using it is even easier:

./local/graftcp-local &   # runs the tunnel in the background to localhost:1080
./graftcp curl ipecho.net/plain

as you observe from the last command, your IP address has been changed. You can run any command you like by just prefixing graftcp:

./graftcp go build
0

You can use http_proxy environmentvariable like this: export http_proxy="socks5://localhost:9050" Now the terminal will use that as proxy. Here I'm using tor proxy, but should work for you, too.