About Trilead SSH open source project

Some time ago I have written an article about the JSch open source project. However, I soon lost all my motivation when I faced, again, the code complexity required for JSch just to start a execution session, a file copy or a port forwarding with JSch. Nevertheless the completely misunderstood authentication API for JSch let me to a mood even worse. I started looking for alternatives and fortunately I found Trilead SSH, a pure Java implementation of SSH, available with the BSD license.

I have not yet tested Trilead SSH extensively to state that it provides a stable and complete SSH implementation. But results were very promising. Unfortunately, I have not much information about performance of data transfer with Trilead SSH.

I think that the major advantage of Trilead SSH is its very simple and intuitive API, directly targeted to tasks that shall be solved for someone that is using SSH. Everything is made very easy: execute a command, do port forwarding, transfer files. All complexity is done behind the scenes and a single method call uses to be enough. There is no need to care about SSH details as it was required for JSch.

In special, I liked the Trilead SSH API resposible for authentication that is very straightforward and matches very well the steps to log into the remote host. Even better, I was able to implement my own logic to respond to authentication failure exactly to the application needs. In this situation Trilead SSH is simplier and more flexible that JSch.

As a drawback, it is not possible to have low level access to the SSH protocol. However, this seems to be a very improbable requirement.

Depite of the simple API, Trilead SSH claims to implement all major ssh features: sessions (remote command execution and shell access), X11 forwarding, local and remote port forwarding, local stream forwarding, SCP and SFTP. Many options are available for authentication methods and cipher types.

The API is very well documented and includes examples and advices, what is very rare on a typical javadoc.

Conclusion

Replacing JSch by Trilead SSH has been a good choice, although I have not yet evidences for better performance nor stability. But the code become considerable simpler and shorted. And development time was reduces many times.

7 Responses to About Trilead SSH open source project

  1. Chris Dornin says:

    I have used both jsch and trilead ssh libraries. I have also done ssh/scp by tunneling down to the native operating system to access ssh/scp using a java runtime process. The best approach has been the trilead ssh library, which unfortunately I found last. I got into problems with jsch doing multithreaded calls and as the author describes above, jsch isn’t well documented. The trilead ssh library worked beautifully. I have done the following tests:

    1. multithreaded ssh/scp.
    2. weird command syntax in my ssh calls, like pipes, etc. This works flawlessly (not so with native ssh accessed via java runtime).
    3. I install a complex j2ee environment with oracle schemas, jboss instances, ldap, etc by using the trilead library for ssh calls. The environment installs consistently, implying that trilead ssh is solid.

    I can’t speak to performance, but it seems pretty good to me. I am grateful for the trilead open source project.

    • viswa says:

      Hai Chris,
      I want to use JSCH . Need to use port forwardingL and do the SCP command. is it possible to share the sample code.
      Regards
      Viswa

  2. Konstantin says:

    Yeah, that’s great library!!
    My choose for client tasks is trilead.
    It has very flexible and beautiful source code. It was easy to modify sources for my-own tasks (e.x. I added own-type channel support).

    Also I can recommend this library as a pure java SSHclient and sshd implementation.

    P.S: But I was sad about this: http://www.trilead.com/SSH_Library/ T
    :( – it’s nott supported and distributed more…

    P.P.S: sorry again for my eng. it’s me again)

  3. jjramos says:

    Hi!

    I’m still testing the library, but it seems to work smooth…

    Konstantin, don’t be sad: I’ve found the trilead-SSH2 package in several linux distributions!

    I’m using Fedora 10, and it includes the package. However, I haven’t found the sources yet… If you find it, please let me know!

  4. Ben says:

    You can find the last source here :
    http://virologie.free.fr/documents/openSSH/ssh_liens.html (see the link on the Ganymed Project).

  5. Marc says:

    Is that implementation at ganymede project the most recently released source version? Anyone know if there’s another more recent source from before they terminated support?

  6. The latest version of Ganymed SSH-2 for Java can be found here: http://www.cleondris.ch/ssh2 This is the official version by Christian Plattner (founder of the original project).

  7. Tanmay Bhola says:

    Hey,
    Thanks for the wonderful insight into the Trilead SSH Library. I am working on Android (Java) on connecting to a remote machine and executing SSH Commands. I have been able to achieve connection and execution, but I am not sure how to receive the command response and find out whether execution completed successfully, so that I can execute the next command.

    Does anyone have a working example that shows multiple command execution and response in Trilead. I have been struggling with this last piece and would really appreciate some help.

    I am using the session.execCommand() method to execute commands.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: