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

This is what I did (using mathematica 9.0.1; remote RHEL linux server for running kernels; local workstation windows 7 64bit):

On the remote kernels-tab I added the hostname of the server. Then I checked the 'Use custom launch command' and added the following:

plink -ssh -batch -l  `3`  `1`  "math -mathlink -linkmode Connect `4` -linkname '`2`' -subkernel -noinit  >& /dev/null &“

To be able to run plink, you should install the putty package and add the installation directory to the system path. The ampersand at the end is required because the math command should be run as a background process and the connection should terminate. Otherwise the command window will stay open and mathematica aborts the session after a while.

Also, to make this work you should disable (or configure) the firewall on the local workstation to allow inbound connections from the remote server. Mathematica will use random port numbers (specified in `2`). The remote server only requires outbound connections.

If your local login name is not the same as your server account, you should replace `3` with your server login name.

To prevent entering a passwords when starting remote kernels, you could use a public key pair (using Pageant for example).

If all is setup properly, you can click the 'parallel kernel status' button and launch all kernels.

On linux systems you can rely on the default ssh implementation:

ssh -x -f -l `3` `1` math -mathlink -linkmode Connect `4` -linkname '`2`' -subkernel –noinit

The -f switch tell ssh to enter background mode before running the command line, so no trailing ampersand is required here.


To summarize the `#` parameters:

`1` = hostname as specified in dialog
`2` = connect string format: port1@ip-workstation,port2@ip-workstation
`3` = username on current workstation
`4` = -linkprotocol TCPIP (i.e. additional parameters)

That should do...


This is not the desired solution, but it is what I ended up doing: I finally gave up on trying to access a remote math kernel under Windows 7 and used a Ubuntu 12.04 image in VMWare which worked as expected.

Since the guy in the last link, who had the same problem 2 years ago, also couldn't make it work and eventually gave up I assume it's some kind of error in the Windows-Package of Mathematica or Windows itself. I can't believe though there are no users who found out how to run it..

Should somebody be able to provide a real solution to that problem I will remove that answer..


Modified upon this answer I managed to connect to the remote kernels. The client laptop is running Mathematica 11.2 on Windows, and remote kernel Mathematica 11.2 on RHEL 7. Here is what I did:

Evaluation -> Kernel Config Options -> Add Advanced Options -> Arguments to MLOpen:

-LinkMode Listen -LinkProtocol TCPIP -LinkOptions MLDontInteract

Advanced Options -> Shell command to launch kernel:

C:\\cygwin64\\bin\\ssh [email protected] "math -mathlink -linkmode Connect -linkprotocol TCPIP -linkname `linkname` -noinit &< /dev/null&"

(note: no -subkernel)

Then Evaluation -> Notebook Kernel -> the_new_created_one

Try to evaluate things like 1+1 or $Version to see if it works. It works for me like a charm and hopefully for you too.

PS. I have been wrestling with this for years, since mathematica 8 or 9. I'm glad it finally works.