SSH in Java application with wait function

Using the wait function, you can execute SSH commands and analyze the output of these commands to change the program flow. I would like to do this using Java. That is, I want my Java application to start an SSH session, execute a command on a remote server, and depend on the output of this command executing the following command, without having to start a new SSH session.

Is this possible in Java?

thanks

+7
source share
3 answers

Self-promotion of my project: after looking at other Java-based Expect libraries, I decided to write my own ... I hope you find this useful. Please open problems on GitHub if you find any problems.

https://github.com/ronniedong/Expect-for-Java

For SSH, I suggest using JSch as an example in the readme file.

+6
source

Try ExpectJ .

+3
source

Yes it is possible. There are several libraries, but I suggest Ganymed SSH-2. You can download it here , and there are also many examples of using functions ...

+3
source

All Articles