LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

run ssh command in labview

does anyone knows how to run an ssh command in labview?
I know how to run some linux commands in labview but my problem is when I try to run an ssh command ...
thks
JP
0 Kudos
Message 1 of 4
(4,349 Views)
Hey JP,

Does your problem stem from the fact that you have no way to enter your password?

If so, you could setup a public/private key and use the authorized_keys file so that ssh never prompts for a password. Everything should work after that.

You could also use an agent so that you only have to enter your password once (before you execute labview).

You could also use a graphical X/gnome agent that will ask for the password instead of trying to read from standard input.

If these ideas won't work for you, just reply and I'll try to find a more suitable solution.

-Duffey
Message 2 of 4
(4,349 Views)
Well, no one of the solutions that you gived to me seems to be what I want ... because I need to run ssh command and enter the password without the user know it ... I need an automatic process that only will be used to change the atributes of my executable file. And, to do that I need to be root ... if there's another way I don't know how ...

In my case I use the object executevi and first I enter the ssh ... then I enter the password ... and in the end I enter the chmod ... but this doesn't work ...

Thks for your help

JP
0 Kudos
Message 3 of 4
(4,349 Views)
Unfortunetly, I don't know how to script in a password for ssh. SSH closes the stdin and re-opens the tty that you are logged in at. This is actually a security feature. As well as a way to send stdin to remote programs (otherwise your password would get in the way.)

If you don't need to ssh to a remote host, and you want to chmod something on the localhost, you could use sudo instead. With sudo you can specify certain users (or all users) to run certain commands. (so you could make a shell script to chmod for you).

I don't know your exact needs, but I think that a public/private keypair could still work. In your authorized keys file on your "root" account, you can even specify that "this public key does not get shell access, and can only execu
te this one command." This would probably be the most secure method. But it requires the user to have the correct private key as well.

If you know that won't work for some reason, then maybe you could setup a inetd process that will execute a command whenever someone connects to a certain port (then you could use LabVIEW's TCP VIs).

Or, if you are not connecting remotely, you could setuid your LabVIEW executable (A VERY BAD IDEA!).

Also, it is possible to script "telnet." It would of course transmit your root password as plaintext, but trying to script your ssh session would also embed your password in your LabVIEW VI. Out internet toolkit for LabVIEW has some helpful telnet VIs.

May I ask why you want to chmod something on a remote system that requires root? Sounds like maybe you should create a LabVIEW application on the remote side that acts as a daemon (running as root) and accepts connections and commands and does the chmodding for you.

-Duffey
0 Kudos
Message 4 of 4
(4,349 Views)