From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

CSLUG - Central South LabVIEW User Group (UK)

cancel
Showing results for 
Search instead for 
Did you mean: 

Interactivley communicate with an SSH session

Hi all CSLUGers,

I am looking for a way to interactively communicate with a remote system using SSH.

I currently have something like this. (Thanks to Steve's VPN presentation for the example)

Untitled.png

This does the job well for one or two commands, but as it creates a new session everytime, is a bit slow. It also does not allow me to do certain tasks.

I am looking for a way to open an SSH session, using a reference to that session communicate with it, and then close the session when complete. There are some applications that I need to run on the remote system which needs interaction and the session to remain open.

Does anyone know if this can be done, ideally without having to write a C# dll?

Thanks,

Greg

0 Kudos
Message 1 of 11
(10,183 Views)

Have you looked at

https://labwerx.net/products/labssh/purchase/

notice I linked you the price page.

Steve


Opportunity to learn from experienced developers / entrepeneurs (Fab,Joerg and Brian amongst them):
DSH Pragmatic Software Development Workshop


Random Ramblings Index
My Profile

0 Kudos
Message 2 of 11
(7,078 Views)

If you fancy playing with .Net

http://sshnet.codeplex.com/

Steve


Opportunity to learn from experienced developers / entrepeneurs (Fab,Joerg and Brian amongst them):
DSH Pragmatic Software Development Workshop


Random Ramblings Index
My Profile

0 Kudos
Message 3 of 11
(7,078 Views)

Thanks Steve,

I did come accross that. Will give a try and see.

0 Kudos
Message 4 of 11
(7,078 Views)

I was playing with that last night.

I got it to work in one method, but my lack of .Net knowledge clearly showed when I tried to separate Connect, Execute and Disconnect into separate methods.

I will brave another go as it must be able to be done. Apparently labwerx is just a dll.

0 Kudos
Message 5 of 11
(7,078 Views)

I'd like to crack the .Net one too, add it to the list after opendoc stuff

Steve


Opportunity to learn from experienced developers / entrepeneurs (Fab,Joerg and Brian amongst them):
DSH Pragmatic Software Development Workshop


Random Ramblings Index
My Profile

0 Kudos
Message 6 of 11
(7,078 Views)

For anyone that is interested, here is a quick and nasty .net application using ssh.net that sort of works.

It connects, sends commands and disconnects. For some reason I can't change directory, but that is a problem for next week.

https://drive.google.com/file/d/0ByzG2Ps_dpjcdU5IUzdDYnp1dWM/view?usp=sharing

Be warned that I am not a .net programmer so when I say this is nasty code, it is!!!!

0 Kudos
Message 7 of 11
(7,078 Views)

So after a few hours of bashing my head against the C# wall, I have a working C# and LabVIEW application, still needs to be cleaned up though.

If anyone is interested, I'd be happy could do a quick presentation at CSLUG about it.

Untitled.png

Message 8 of 11
(7,078 Views)

Very interested indeed matey, I'll pop it on the discussion for May.

Steve


Opportunity to learn from experienced developers / entrepeneurs (Fab,Joerg and Brian amongst them):
DSH Pragmatic Software Development Workshop


Random Ramblings Index
My Profile

0 Kudos
Message 9 of 11
(7,078 Views)

Nice one Greg. I got asked by a customer recently about communicating with a Linux device via SSH through Teststand. I did a little bit of prototyping and got some responses from one of our Linux based cRIO's, but haven't yet had a chance to take it any further.

Hopefully I'll be doing more work with this customer soon so might have some more ideas on it for when you present - or if that hasn't happened yet I'll be listening carefully for all the potential pitfalls

Cheers

0 Kudos
Message 10 of 11
(7,078 Views)