# Remote Mathkernel: SSH encountered a networking error while launching kernel Error code = 1

I have a problem concerning the connection to a remote kernel via ssh on a vpn. I found a working configuration in this question:

Connection to remote kernel can not be established - No specific error shown

However, I use Windows 7 as my client and therefore cannot run the same command as the kind sir there provided in his answer:

ssh -R 31415:10.8.0.6:31415 -R 31416:10.8.0.6:31416 user@10.8.0.1 "dbus-launch --exit-with-session /usr/local/bin/math -mathlink -LinkMode Connect ..." because Windows does not have openssh built in but instead adapted that command to use the installed openSSH version of cygwin:

This command DOES work if I run it directly in the windows console, the connection with the private key gets established, but when I try this same command in the remote kernel configuration the error in the title occurs without more specific troubleshooting help. Also the other question dealing with that error I could find had passphrase/private key problems and couldn't even connect via the console.

Upon inspecting the differences of the openssh version I noticed my client in cygwin uses 6.1p1 while the server uses 5.5p1. I tried installing a current openssh version on the Debian 6.0 server but the last officially supported and maintained one for that OS version is 5.5p1 and it doesn't seem such a good idea to me to upgrade to a not officially supported version. When trying to install an older version in cygwin, I cannot even select an older openssh version when running the cygwin setup again and selecting a cygwin packages mirror. So I searched for ~10 alternative mirrors that provide older openssh packages, but they all seem to lack a "setup.ini" file so no connection could be established.

I ask for help here because this seems to be a Mathematica specific problem, not a ssh related one..other clients with Mac OS X 10.8 can connect to the server using the same private key fine..

Does anyone have a similar setup and could give me a hint what might cause the error? Is there something I did not see in the remote kernel configuration? I use Mathematica 8.0.4, Windows 7 64bit client with openssh-6.1p1, Debian 6.0 server with openssh-5.5p1, cygwin 1.7.17.

Thank you!

Update: In the meantime I found someone with nearly the same problem, however 3 years ago and with no answer (i hope you don't mind links to other platforms: https://groups.google.com/forum/#!topic/comp.soft-sys.math.mathematica/K-Z3xbQNzbY

-
 Entering things into that "custom launch command" box seems to be a bit unreliable in my experience. You might instead try assigning your launch command (as a string) to the variable SubKernelsRemoteKernels$RemoteCommand--then you just need to tick the box when adding a kernel to have this remembered. – Oleksandr R. Mar 14 at 4:45 thanks Oleksandr R. , I tried your suggestion, I typed this command SubKernelsRemoteKernels$RemoteCommand = "C:\Users\\bin\bash--login-i-c \"ssh -v -i \ /cygdrive/c/Users//path/to/key user@10.8.0.1 /usr/local/bin/math -mathlink -LinkMode Connect -LinkProtocol TCPIP -LinkName linkname -LinkHost 10.8.0.6\"" into an empty notebook and run it, just to test the connection, however, still no success, the same error persists..do you have any other suggestions? – hajn Mar 16 at 23:33 Don't forget that \ also needs to be escaped (as \\) in strings. Other than that, I'm not quite sure--I don't have this same configuration, so unfortunately I can't tell you what's likely to work. If you still have trouble, perhaps you might like to try using ssh port forwarding to set up the connection ahead of time? – Oleksandr R. Mar 17 at 5:43 oh, of course, I escaped it correctly, just copied it from somewhere else unescaped..unfortunately ssh portforwading also did not do the trick..if you happen to have any more hints I would be glad to try them, thanks for your effort – hajn Mar 18 at 21:21