I am trying to translate the GUI settings in Putty for establishing SSH tunnel to command line in Windows batch script. The first batch script establishes the port forwarding and tunnel ...

start putty -ssh root@ -pw my_secure_pw -L 5555: -L 2222:

and the second batch script uses the tunnel ...

start putty -ssh localhost 5555

While the first script runs without error, I keep getting Putty Fatal Error: Server unexpectedly closed network connection for the second one.

However, if I establish the tunnel using GUI as per snapshot below, and run the second script, there was no error and I can run the application accordingly.

Is there any missing configuration or option from the first script, if compare to the GUI?

enter image description here


From the command line, the local ports tunnel to the remote IP while the GUI variant uses as destination.

Additionally, the destination's SSH daemon is probably listening on port 22, so you'd need to use the local port 2222 instead.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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