Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a very different situation. My laptop named A, another machine B(ip- with ssh server installed and i have an account on that machine, the third machine C(ip- is a proxy server. All the machines are within a LAN, but

1- Machine B can connect to A as well as C

2- Machine A pc, it can only connect to B and not C

Now to use internet, i do the following:

ssh -X user@

Then i type firefox and i use the firefox of machine B with proxy setings as

Instead of using firefox of B, i want to use my local firefox. Is there a way through which i can connect to C via B and use my local firefox for browsing

share|improve this question
up vote 0 down vote accepted

Since laptop A has ssh access to B, and B has access to port 3128 on machine C, you can set up port forwarding to bind port 3128 on machine C to port 3128 on your local computer (A). Then you can set up firefox proxy settings on your laptop to localhost:3128 and it will be using port 3128 on machine C for proxy services.

ssh -L 3128: user@


-L = Take a remote port and bind it to some local port
3128 = The local port to bind to = The remote host (proxy server) who's port you want access to.
3128 = The port on the remote host (proxy server) that you want access to.
user@ = the ssh server 

This method can be used to gain access to any port on any machine that the ssh server can see on the network (one port at a time).

Once a connection is established, you can set up firefox on your laptop just as it is on machine B except use localhost:3128 instead of in the proxy settings.

("localhost" should be the same thing as

share|improve this answer
Thanks for such a detailed answer, but it is not working because i don't have an ssh account on I can't even connect to directly. You have used user@ instead of user@, as a result the above request simply times out! – adnan kamili Mar 26 '12 at 0:04
@adnan kamili Sorry I mixed up the addresses. I think I fixed it. – James T Mar 26 '12 at 0:07 is the ssh server and 172.16..24.3 is the proxy server, you made a mistake! but ssh -L 3128: user@ also does not work. – adnan kamili Mar 26 '12 at 0:11
@adnan kamili At what point does it fail to work? Are you able to connect to the ssh server? Does it fail when you try to use firefox? Do you get any error messages? – James T Mar 26 '12 at 0:14
Yes it connects to ssh server. When i put proxy in firefox the request simply times out. – adnan kamili Mar 26 '12 at 0:21

The -D argument allows ssh to create a SOCKS proxy which you can then connect to with Firefox.


ssh -D user@

Then you open Firefox and set with port 9051 as a SOCKS5 proxy.

For more information, see man ssh.

share|improve this answer
It doesn't work, if i use ssh -D 9999 user@ and use as proxy in local firefox, nothing happens because is not a proxy server – adnan kamili Mar 25 '12 at 21:29
I also tried proxychains, to chain the local proxy server created using ssh -D with and results are somewhat weird. |DNS-request| |S-chain|-<>-<>-<><>-<--denied – adnan kamili Mar 25 '12 at 21:32
ssh -D user@ , still the same – adnan kamili Mar 25 '12 at 22:44

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .