Help coderanch get a
new server
by contributing to the fundraiser
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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

 
Ranch Hand
Posts: 188
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Sheriff
Posts: 22791
131
Eclipse IDE Spring Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ?
 
catch it before it slithers away! Oh wait, it's a tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/t/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic