Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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'm able to establish an ssh connection from my windows computer (localhost - eth1) to my linux computer (remotehost - eth0) by doing:

ssh user@

Instead of using that, because I use non-standard ports I have to specify the port:

ssh -p remoteSSH user@

I then forward http and ssl to the remotehost's http and ssl ports. I have some services I want to use on the linux box so I use this:

ssh -L 80:
ssh -L 443:

Lastly, I try to "securely" reverse forward traffic from the (localhost) through the (remotehost) and back to the (localhost). But, with this connection I need the socks proxy to be I was successful in creating a non-socks proxy which points proxy1 to the [specific port aka proxy2] on the (localhost) via the above forwarding method but I'm trying to avoid having to constantly modify html files to point to the proxied port.

When I used putty, I had connectivity for all the above connections except for the dynamic socks connection which only worked to forward standard http/s traffic. I do not want to create a proxy to the internet. I've stopped using putty because it drops connections and it crashes whenever forwarding traffic. The latter is a known bug:

These features were new in beta 0.61 (released 2011-07-12):
    Bug fix: corruption of port forwarding is fixed (we think).

These features were new in beta 0.59 (released 2007-01-24):
    Bug fix: SSH-1 connections tended to crash, particularly when using port forwarding.

These features were new in beta 0.58 (released 2005-04-05): 
    Fixed crashing bug with remote port forwarding.

These features were new in beta 0.53 (released 2002-10-01): 
    Various bug fixes, including (with luck) much greater stability in high-traffic port forwarding situations.

So, on the windows box, I moved to cygwin for openssh. The command I've come up with so far is:

ssh -t -t -L 80: -L 443: -p remoteSSH user@ -R proxy1: "ssh -D randomport"

To test the connection from proxy1 to proxy2, in Firefox I set:

HTTP Proxy:                 Port:
SSL Proxy:                  Port:
FTP Proxy:                  Port:
SOCKS Host:       Port: proxy1
No Proxy for:

I get a response saying the proxy server is refusing connections. I've created rules in the Windows box to allow the connections. I disabled my Windows firewall and allowed the connection in iptables on the linux box via:

$IPTABLES -A OUTPUT -o eth1 -p tcp -m tcp -s -d --dport randomport -j ACCEPT

iptables is already setup to allow local traffic. I use password protected host-based private key authentication. I have syslog-ng (cygwin) logging ssh.

Perhaps, as an alternative or in addition to the question, someone can direct me to linux and/or Windows tools that can help me diagnose the problem. For Windows, I have Windows System Control Center with Sysinternals Suite and Nirsoft Utilities. The Windows System: Windows 7. Linux: Slackware 64

share|improve this question
up vote 0 down vote accepted

I decided to use a time tested approach of trial and error. This is what allowed access to proxy2:

ssh -t -t -D proxy1 -R proxy2: -p remoteSSH user@

In Firefox, I can now enter:

which will send the connection through the tunnel (proxy1) to the local proxy (proxy2) essentially becoming a local-remote-local tunnel to a specific port.

While proxy2 is accessible through proxy1, proxy1 is allowed access to the internet. To limit what the proxies were allowed to access, I added a PermitOpen entry in the sshd_config file of the remote host at according to the man page:

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.