Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Can't connect to ssh server using jsch or sshtools -- OpenSSL misconfiguration or coding error?

 
James Adams
Ranch Hand
Posts: 188
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have written two methods for issuing an ssh command -- one using jsch version 0.1.31 and another using j2ssh-core version 0.2.9 -- and neither of them get past the connect step so I assume it's not an authentication problem since I don't even get to that step. With the code which uses the jsch library I get a JSchException: Algorithm negotiation fail, and with the code which uses the sshtools library I get an IOException: Socket is EOF. I have no clue as to what either of these exceptions indicate, and have found nothing so far using Google, amiling list archives, etc. However if I try the same ssh command at command line I have no errors. So it seems that my error is somehow related to running the Java code and not with the ssh configuration, but I'm not certain and hoping that someone reading this can guide me to a way of determining whether or not that's the case, and if so how to fix things.

When I run 'ssh -V' on both the local machine where I am running my Java codes as well as on the remote machine where I am trying to run the ssh commands I get the following result:

Sun_SSH_1.3, SSH protocols 1.5/2.0, OpenSSL 0x0090801f

Is there a way to determine whether or not this version of OpenSSL is compatible with either or both of the ssh libraries I'm using for this task?

Below are snippets of the code I have written -- I think they're OK but maybe I've done something wrong at the Java level and if so then please point it out to me:



Thanks in advance for any suggestions or ideas.

--James
 
Rob Spoor
Sheriff
Pie
Posts: 20511
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you set the SSH protocol to use in JSch or sshtools? Perhaps they are using SSH protocol 1.0 by default, and your server doesn't support that.
 
James Adams
Ranch Hand
Posts: 188
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks, Rob. I don't see a way in either library to set the protocol level that the client instance should use, however both of these libraries support SSL 2.0 so I don't think that that is the issue. In any event I've resorted to a brute force approach running ssh and scp commands using Runtime.exec() in order to move on and get some work done. It's not elegant but it's working fine for now.

--James
 
Toufik Hamdani
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have exactly the same problems as you. I don't know how to bypass this problem. Did anyone have the same problem and find how to resolve it ?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic