Quick tip: Running a terminal command through a proxy (Linux)


Sometimes, running a full VPN is not necessary, or there is not enough bandwidth for all your traffic. In cases of using Tor for example, tunneling all your traffic can even be dangerous!

So you can specify per command you execute if you want to have it tunnel its web traffic through the proxy.

If you, for example want to download a file through the proxy with the wget command. Just prepend the command with ‘proxychains’ and done!

proxychains wget www.remoteserver.com/fileineed

Great! that works, but gives some output, your can silence this with the -q flag.

proxychains -q ...

To set it up on your system follow the following steps…

1. Installation

For example on Arch Linux do:

pacman -Sy proxychains

On Ubuntu or other Debian-based distro’s:

apt-get install proxychains

2. Configuration

Proxychains has a lot of configuration options but all you need to do, is go to the end of the file /etc/proxychains.conf and edit the last line;

#nano /etc/proxychains.conf
~socks4 9050

It’s preconfigured to use tor,
That means a socks4 proxy on localhost port 9050.
Configure this to your needs, for example to use a SOCKS5 proxy made by SSH do this;
– Command to run to make the SSH connection

ssh remoteserver -D 5000

– Edit the configuration file like this:

socks5 5000

3. Done!

That’s it!
Proxies can be amazing to change your appearance to the public internet, get to otherwise inaccessible content or tunnel your way out of a restrictive firewall/filter.


Leave a Reply to Quick Tip: A transparent poor man's VPN with sshuttle - Dem Geeks Cancel reply

Please enter your comment!
Please enter your name here