1

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@10.54.20.98 -pw my_secure_pw -L 5555:10.54.22.104:5432 -L 2222:10.54.22.104:22

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

2

From the command line, the local ports tunnel to the remote IP 10.54.22.104 while the GUI variant uses 10.54.22.102 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.