Java implementations of SSH?

Discussion in 'Java' started by Daniel Pitts, Dec 3, 2008.

  1. Daniel Pitts

    Daniel Pitts Guest

    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.
    --
    Daniel Pitts' Tech Blog: <http://virtualinfinity.net/wordpress/>
    Daniel Pitts, Dec 3, 2008
    #1
    1. Advertising

  2. Daniel Pitts

    Roedy Green Guest

    On Tue, 02 Dec 2008 20:36:28 -0800, Daniel Pitts
    <> wrote, quoted or indirectly
    quoted someone who said :

    >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)
    Roedy Green, Dec 3, 2008
    #2
    1. Advertising

  3. Daniel Pitts

    Daniel Pitts Guest

    bugbear wrote:
    > Daniel Pitts wrote:
    >> 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.

    >
    > 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).

    --
    Daniel Pitts' Tech Blog: <http://virtualinfinity.net/wordpress/>
    Daniel Pitts, Dec 3, 2008
    #3
  4. Daniel Pitts

    Guest

    On Dec 3, 5:47 pm, Daniel Pitts
    <> wrote:
    > bugbear wrote:
    > > Daniel Pitts wrote:
    > >> 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.

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

    ....
    > 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.
    , Dec 12, 2008
    #4
  5. Daniel Pitts

    Daniel Pitts Guest

    wrote:
    > On Dec 3, 5:47 pm, Daniel Pitts
    > <> wrote:
    >> bugbear wrote:
    >>> Daniel Pitts wrote:
    >>>> 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.
    >>> On a slight tangent strongly multi-threaded applications shell out
    >>> VERY poorly, since all the threads are stopped to perform
    >>> the fork(), then restarted.

    > ....
    >> 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.
    >

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

    --
    Daniel Pitts' Tech Blog: <http://virtualinfinity.net/wordpress/>
    Daniel Pitts, Dec 12, 2008
    #5
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. loial
    Replies:
    0
    Views:
    387
    loial
    Feb 3, 2009
  2. loial
    Replies:
    0
    Views:
    391
    loial
    Feb 10, 2009
  3. Tench Johnson
    Replies:
    1
    Views:
    279
    Biff Tannen
    Apr 23, 2010
  4. salamond

    net/ssh in ruby. ssh.exec fails

    salamond, Feb 17, 2011, in forum: Ruby
    Replies:
    0
    Views:
    226
    salamond
    Feb 17, 2011
  5. Deepika
    Replies:
    2
    Views:
    199
    Deepika
    Nov 14, 2006
Loading...

Share This Page