Java implementations of SSH?

D

Daniel Pitts

I've looked at JSch, and it seems like a working candidate, but it
doesn't seem to be written in a thread safe manner, and it hasn't been
javadocced at all. Trilead looks promising as well.

Does anyone have experience with these (or any other) SSH library in
Java? The primary use case is in an automation system, running remote
commands in batch on multiple hosts. The existing system uses
ProcessBuilders and executes "ssh" locally. It is a highly concurrent
application, so any solution we choose *must* be thread safe.

Thanks,
Daniel.
 
R

Roedy Green

I've looked at JSch, and it seems like a working candidate, but it
doesn't seem to be written in a thread safe manner, and it hasn't been
javadocced at all. Trilead looks promising as well.

Does anyone have experience with these (or any other) SSH library in
Java? The primary use case is in an automation system, running remote
commands in batch on multiple hosts. The existing system uses
ProcessBuilders and executes "ssh" locally. It is a highly concurrent
application, so any solution we choose *must* be thread safe.

For a list of possibilities see http://mindprod.com/jgloss/ssh.html

Unfortunately I have no recommendations.
--
Roedy Green Canadian Mind Products
http://mindprod.com
"Humanity is conducting an unintended, uncontrolled, globally pervasive experiment
whose ultimate consequences could be second only to global nuclear war."
~ Environment Canada (The Canadian equivalent of the EPA on global warming)
 
D

Daniel Pitts

bugbear said:
On a slight tangent strongly multi-threaded applications shell out
VERY poorly, since all the threads are stopped to perform
the fork(), then restarted.

Which means if you had (e.g.) a tomcat with a 300 tread process pool,
shelling out could be ... unfortunate.

DAMHIKT

BugBear
That is exactly one of the reasons I wish to use a Java native SSH
library :)

Fortunately, the number of active threads is relatively small for the
whole application, and responsiveness isn't a high priority.
Correctness is highest priority (it is a mission critical app).
 
N

neuneudr

....
That is exactly one of the reasons I wish to use a Java native SSH
library :)

I don't know if this could help you but in my case I solved this
problem by creating a (non-portable) script that takes care
of consuming "ssh orders" and warning the Java app every time an
order has been correctly executed.

If I have, say, 3000 scp commands to run, I can launch ten times
the script from Java and give 300 orders to each script.

That way I only ever call ten scripts, when the Java app starts up
and then just communicate with them.

Not native Java but it worked for us.
 
D

Daniel Pitts

I don't know if this could help you but in my case I solved this
problem by creating a (non-portable) script that takes care
of consuming "ssh orders" and warning the Java app every time an
order has been correctly executed.

If I have, say, 3000 scp commands to run, I can launch ten times
the script from Java and give 300 orders to each script.

That way I only ever call ten scripts, when the Java app starts up
and then just communicate with them.

Not native Java but it worked for us.
Not a bad idea, but doesn't work for our situation. We have a few
scripts that we need to execute on many machines.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,535
Members
45,007
Latest member
obedient dusk

Latest Threads

Top