Skip to main content

networking - How do you use ssh-keys instead of a password to run a remote-kernel over ssh?


On all of the servers that I regularly interact with, I have ssh-keys setup for passwordless access via ssh. Yet, every time I attempt to start a remote-kernel over ssh, I get asked for a password despite having a ssh-keyagent up and running. What do I need to add to the kernel configuration, such as the launch command, to have it use my ssh-key?


I'm using version 8.0.4 on MacOS 10.6.8, if it makes a difference.



Answer



Mathematica by default uses its own ssh implementation. You can see it in the dialog of the remote kernel configuration dialog in the advanced options: `java` -jar `mathssh`. As far as I know, you can safely replace that with the local ssh command (most likely /usr/bin/ssh). You have to select the "Advanced Options" radiobutton to do that (if you first add all the standard options, the rest of the command is already filled in correctly).


Edit: By default, Mathematica uses the launch command


`java` -jar "`mathssh`" user@hostname math -mathlink 
-LinkMode Connect -LinkProtocol TCPIP -LinkName "`linkname`"
-LinkHost `ipaddress`


to invoke ssh, where user and hostname are filled in via text boxes above. To use the local ssh command, you need to change the above command to


ssh user@hostname "math -mathlink -LinkMode Connect -LinkProtocol TCPIP 
-LinkName `linkname` -LinkHost `ipaddress`"

This appears to have one flaw, killing the remote kernel via the front-end no longer kills the processes on the remote server. So, that will have to be done by hand.


Comments