Using Public Key Authorization with LabVIEW SSH

Updated Sep 18, 2023

Environment

Software

  • LabVIEW

I want to open an SSH connection to a remote machine using LabVIEW.
How can I gain login access on the remote machine using an authorized key?

Starting with version 2021, LabVIEW has build in support for SSH and SFTP. Using the NI_SSH library, you can use OpenSSH or PuTTY SSH to open an SSH tunnel to a remote device and execute commands on it.

By default, the connection you open should be authenticated by the remote machine (often referred as the server). To authenticate yourself - or in this case the LabVIEW application - on the server, you will need to specify a user and either a password or an authorized key.

To specify a password for the SSH connection, use a Property Node for the OpenSSH/PuTTY Client object and wire the password as a string.

As a preferred alternative, you can use a key file to authorize the connection. To specify the key file's location on the client computer you can use the 'Additional Options' Property Node element on the OpenSSH/PuTTY Client object and add an Array Element specifying the file path following the "-i" argument. An example for this is shown below:

AdditionalOptionsSSHkeyFile.png

For more information on generating the SSH authentication key pair you can visit the corresponding page on the SSH website.