Using ssh as a socks proxy

Valic —  January 5, 2012 — Leave a comment

Ssh can support forwarding traffic & act as a SOCKS proxy.

This is fantastic for encrypted browsing over unsecured wifi connections. You can setup Firefox, YM or any other SOCKS 5 compliant program to make use of the proxy. After executing the command below ssh will be listening on localhost ( and you would then point your SOCKS compliant program to this ip and port that you specify below.

The command:

ssh -qTfnN2 -D 8080 -p 22 [email protected]


-q :- be very quite, we are acting only as a tunnel.
-T :- Do not allocate a pseudo tty, we are only acting a tunnel.
-f :- move the ssh process to background, as we don?t want to interact with this ssh session directly.
-N :- Do not execute remote command.
-p :- Port to connect to on the remote host.
-n :- redirect standard input to /dev/null.
-2 :- Forces ssh to try protocol version 2 only.
-D :- Specifies a local “dynamic” application-level port forwarding.This works
by allocating a socket to listen to port on the local side,and whenever a connection
is made to this port, the connection is forwarded over the secure channel, and the application
protocol is then used to determine where to connect to from the remote machine.
Currently the SOCKS4 and SOCKS5 protocols are supported, and ssh will act as a SOCKS server.
Only root can forward privileged ports.


Squid is used by hundreds of Internet Providers world-wide to provide their users with the best possible web access. Squid optimises the data flow between client and server to improve performance and caches frequently-used content to save bandwidth.

Squid can also route content requests to servers in a wide variety of ways to build cache server hierarchies which optimise network throughput.

Step 1. Install  Squid

apt-get install squid

Step 2. Allow your network to use the proxy server.

Append lines similar to these to your config. Continue Reading…

Page 1 of 11