Send and recieve multiple ssh commands via java runtime and cygwin

Posted by Moustachio on Stack Overflow See other posts from Stack Overflow or by Moustachio
Published on 2010-03-17T02:05:24Z Indexed on 2010/03/17 2:11 UTC
Read the original article Hit count: 436

Filed under:
|
|
|
|

Hey I have run into the following problem when attempting to build a program in java which executes commands on a remote linux server and returns the output for processing...

Basically I have installed Cygwin with an SSH client and want to do the following:

Open Cygwin,

Send command "user@ip";

Return output;

Send command "password";

Return output;

Send multiple other commands,

Return output;

...etc...

So far:

Process proc = Runtime.getRuntime().exec("C:/Power Apps/Cygwin/Cygwin.bat");

Works nicely except I am at a loss as to how to attempt the next steps.

Any help?

© Stack Overflow or respective owner

Related posts about cygwin

Related posts about ssh