SSH connection with keyfile

I am trying to connect to a ftp server using ssh connection node with keyfile (only option).
Unfortunately I can’t get the node to read the keyfile from the server ( I uploaded it).

With everything I tried, to me it looks like the ssh connection node can only read local files.

Does anyone know anything or how to make it work?

Thanks in advance!

Hi,

do you want to run the workflow locally or on the server.
How exactly do you access the keyfile? Do you use a knime://-URL?
Could you please provide the location you’ve entered in the dialog or even share a screenshot of it?

Cheers,
Moritz

I want to run the workflow from the server, thats why I need the keyfile on the server and the ssh connection node to read the keyfile from the server.

And yes…my problem ist exactly: how can I access that file: what dialog/path/etc. do I need ?

I uploaded the keyfile myself in my folder, so I can read/copy the absolute URL and the mountpoint URL.
absolute: knime://knime-server/myfolder/subfolder/key.ppk
mountpoint-relative: knime://knime.mountpoint/myfolder/subfolder/key.ppk

If I put any of those paths directly in the ssh connection node, I get an error.
If I put them in table creator and use string to uri, as flow variable etc., I get an error

The error does not happen while executing the ssh connection node, that goes on green, unless you test the connection in the options. The error happens while trying to upload a file.
-> the workllow works locally with a local key without a problem.

I usually get:
Execute failed: Can’t resolve key file path from URL "knime://knime-server/myfolder/subfolder/key.ppk
from the upload node.

also…the file I am uploading is also on the server, and for that file the path knime://knime-server/myfolder/subfolder/file.csv works fine, at least when I run it locally with a local key (the same key).

Hi,

sorry for the late reply.
I investigated it and indeed this is a bug in the SSH Connection node as it doesn’t resolve remote knime-urls correctly. I will create a ticket for that to be fixed.

Edit: on a more general note, I’ve noticed that your key has .ppk ending which seems to be the PuTTY format. However the SSH Connection node can only handle keys in the OpenSSH key format, see ssh connection - list remote files - execute failed

Cheers,
Moritz

2 Likes

Thank you for help.

Fortunately, converting the keys into openssh is not a problem.
Unfortunately, almost all (to be) automated workflows need that ssh connection.
I hope it will be fixed soon.

Hi,

there are two workarounds concerning your problem:

The first workaround is to add the keyfile into your workflow, i.e. copy and paste it into the folder of the workflow where you want to reference it. This folder can be found in your KNIME workspace. Reference the key in your workflow via knime://knime.workflow/key, (knime://knime.workflow/ references your base folder of the workflow). The drawback is that you have to copy the keyfile into each workflow that needs it and the whole workflows have to be uploaded if you have to update the keyfile.

The second workaround only works for when you are using your KNIME Server with an RMI executor.
Instead of referencing the key file using the knime://-URL you can provide the complete path to the keyfile. For that you have to know the path to the root of the server repository (e.g. /home/knime/knime_server/workflow_repository/). This has the advantage that you can update the key file any time by simply uploading it to the repository and replacing the old one. You can also place the key somewhere else but you have to ensure that the executor has read access. However, once you switch to distributed executors (e.g when RMI executors are retired) this solution won’t work anymore and you would have to update your workflows (whereas the first workaround still works with distributed executors).

Cheers,
Moritz

3 Likes

I tried the first workaround and it works fine - so that’s fine until the node is fixed.
Thank you!

1 Like