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 have two machines, one running Windows and the other running Ubuntu, and an application running on Ubuntu that connects to a server counterpart running either locally or remotely. The server is running remotely on Windows, and I am attempting to make the client app on Ubuntu believe that the server is actually running locally by forwarding the appropriate port (i.e. 5555) from Windows to Ubuntu. I then tell the client app to connect locally to on the specific port I have set. When this happens, I get the following error in my terminal:

C:\>debug1: Connection to port 5555 forwarding to localhost port 5555 requested.
debug2: fd 9 setting TCP_NODELAY
debug2: fd 9 setting 0_NONBLOCK
debug3: fd 6 is 0_NONBLOCK
debug1: channel 3: new [direct-tcpip]
buffer_get_ret: trying to get more bytes 4 than in buffer 0
buffer_get_string_ret: cannot extract length
buffer_get_string: buffer error

At this point the SSH connection is terminated, dumping me back to a regular terminal prompt. My knowledge of SSH is pretty much limited to connecting to another machine for remote control; port forwarding is new to me so any insight is very appreciated!

Update: I solved the issue by SSHing to the Ubuntu machine from the Windows machine with remote port forwarding. This effectively accomplishes the exact same thing as what I attempted previously. This way produced no errors or disconnection when I connected the client app on the Ubuntu machine to the server app running on Windows.

While this of course makes me happy, as I accomplished my objective, I would now like to figure out why this second way works (remote port forwarding from Windows to Ubuntu, initiated by Windows) and the first way does not (local port forwarding from Windows to Ubuntu, initiated by Ubuntu).

share|improve this question
Can you tell us how you establish the ssh forwarding between the 2 hosts? What are the args given to the command? – Tonin Mar 19 '13 at 13:03
I initiate the connection with ssh -L 5555:localhost:5555 user@remotehost, then log in with an admin account on the remote host (the Windows machine). – spotlightdev Mar 19 '13 at 13:24
Can you successfully ssh to the Windows server from Ubuntu with ssh user@remotehost? – jaume Mar 19 '13 at 13:50
Yes, I can connect without any problems, I can navigate the entire hard drive, make changes, etc. It's only when I attempt to connect to the forwarded port in Ubuntu that the console displays the above error and kicks the whole connection. – spotlightdev Mar 19 '13 at 13:56

Your Answer


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

Browse other questions tagged or ask your own question.