ganymed ssh-2 for java,用于java连接问题的Ganymed SSH(Ganymed SSH for java connect issue)

用于java连接问题的Ganymed SSH(Ganymed SSH for java connect issue)

我们正在使用Ganymed-SSH库并在与另一台机器进行SSH时遇到此错误。

[root@XXXX test]# java -classpath .:ganymed-ssh2-build210.jar Basic

ERROR:java.io.IOException: There was a problem while connecting to 10.X.X.X:22

java.io.IOException: There was a problem while connecting to 10.X.X.X:22

at ch.ethz.ssh2.Connection.connect(Connection.java:699)

at ch.ethz.ssh2.Connection.connect(Connection.java:490)

at Basic.main(Basic.java:27)

Caused by: java.io.IOException: Key exchange was not finished, connection is closed.

at ch.ethz.ssh2.transport.KexManager.getOrWaitForConnectionInfo(KexManager.java:91)

at ch.ethz.ssh2.transport.TransportManager.getConnectionInfo(TransportManager.java:229)

at ch.ethz.ssh2.Connection.connect(Connection.java:655)

... 2 more

Caused by: java.io.IOException: Cannot read full block, EOF reached.

at ch.ethz.ssh2.crypto.cipher.CipherInputStream.getBlock(CipherInputStream.java:81)

at ch.ethz.ssh2.crypto.cipher.CipherInputStream.read(CipherInputStream.java:108)

at ch.ethz.ssh2.transport.TransportConnection.receiveMessage(TransportConnection.java:231)

at ch.ethz.ssh2.transport.TransportManager.receiveLoop(TransportManager.java:669)

at ch.ethz.ssh2.transport.TransportManager$1.run(TransportManager.java:468)

at java.lang.Thread.run(Thread.java:636)

任何人都可以解释这里可能出现的问题吗? 我们应该从哪里开始调试? 普通shell的SSH访问正常。

We are using the Ganymed-SSH library and facing this error while doing SSH to another machine.

[root@XXXX test]# java -classpath .:ganymed-ssh2-build210.jar Basic

ERROR:java.io.IOException: There was a problem while connecting to 10.X.X.X:22

java.io.IOException: There was a problem while connecting to 10.X.X.X:22

at ch.ethz.ssh2.Connection.connect(Connection.java:699)

at ch.ethz.ssh2.Connection.connect(Connection.java:490)

at Basic.main(Basic.java:27)

Caused by: java.io.IOException: Key exchange was not finished, connection is closed.

at ch.ethz.ssh2.transport.KexManager.getOrWaitForConnectionInfo(KexManager.java:91)

at ch.ethz.ssh2.transport.TransportManager.getConnectionInfo(TransportManager.java:229)

at ch.ethz.ssh2.Connection.connect(Connection.java:655)

... 2 more

Caused by: java.io.IOException: Cannot read full block, EOF reached.

at ch.ethz.ssh2.crypto.cipher.CipherInputStream.getBlock(CipherInputStream.java:81)

at ch.ethz.ssh2.crypto.cipher.CipherInputStream.read(CipherInputStream.java:108)

at ch.ethz.ssh2.transport.TransportConnection.receiveMessage(TransportConnection.java:231)

at ch.ethz.ssh2.transport.TransportManager.receiveLoop(TransportManager.java:669)

at ch.ethz.ssh2.transport.TransportManager$1.run(TransportManager.java:468)

at java.lang.Thread.run(Thread.java:636)

Can anyone explain what could be the issue here? Where should we start to debug from? SSH access from normal shell works correctly.

原文:https://stackoverflow.com/questions/13877069

更新时间:2019-12-01 03:22

最满意答案

可能您的公钥存在问题

ssh failed after 141742-01/02 patch on solaris 10 !

Enabled aes192/aes256 support in ssh/sshd does not work on S10u3 or older released

A workaround is to disable the use of aes192/aes256 ciphers for ssh and sshd. Change the two config files /etc/ssh/ssh_config and /etc/ssh/sshd_config and add the following line:

Ciphers aes128-ctr,aes128-cbc,arcfour,3des-cbc,blowfish-cbc

You’ll have to restart sshd to pickup the change (“svcadm restart ssh”).

2013-02-06

相关问答

看看这本书 Struts+Spring+Hibernate 整合教程 v1.0PDF文档下载地址: http://blog.jacken.com.cn/struts-spring-hibernate-_-integration.yy

您好:   感谢你对EasyJF的关注以及对国内开源的支持,国内环境普遍浮躁,因为有太多像春迷这样的人存在,搞得大家都不敢表达自己的思想了,因此还希望以后能继续多对国内开源人给予支持。 关于您来信中说到的问题,我觉得可能是你对java的基础的掌握还不够的原因,简单来说就是内力不够。好比中国传统武侠小说中练武人的内力问题,降龙十八掌这样的绝世掌法,要是没有一定的内力作基础的话,就只能是降蛇十八掌,甚至蛇都降不了。虚竹小和尚的武功也是因为有了高深的内力,才能变得那么牛的。 而修练J2EE武学的内力,我

...

您好:   感谢你对EasyJF的关注以及对国内开源的支持,国内环境普遍浮躁,因为有太多像春迷这样的人存在,搞得大家都不敢表达自己的思想了,因此还希望以后能继续多对国内开源人给予支持。 关于您来信中说到的问题,我觉得可能是你对java的基础的掌握还不够的原因,简单来说就是内力不够。好比中国传统武侠小说中练武人的内力问题,降龙十八掌这样的绝世掌法,要是没有一定的内力作基础的话,就只能是降蛇十八掌,甚至蛇都降不了。虚竹小和尚的武功也是因为有了高深的内力,才能变得那么牛的。 而修练J2EE武学的内力,我

...

可能您的公钥存在问题 ssh failed after 141742-01/02 patch on solaris 10 ! Enabled aes192/aes256 support in ssh/sshd does not work on S10u3 or older released A workaround is to disable the use of aes192/aes256 ciphers for ssh and sshd. Change the two config files

...

一个问题可能是您正在执行的命令的分号。 $stdout_stream = ssh2_exec($connection, "java -version");

$err_stream = ssh2_fetch_stream($stdout_stream, SSH2_STREAM_STDERR);

$dio_stream = ssh2_fetch_stream($stdout_stream, SSH2_STREAM_STDDIO);

stream_set_blocking($err_stream,

...

您的错误是由最后一次Caused by : Caused by: android.os.NetworkOnMainThreadException

当您尝试在主线程上执行网络操作时,抛出此异常。 要解决此问题,可以使用AsyncTask类作为后台操作执行连接。 Your error is caused by the last Caused by: Caused by: android.os.NetworkOnMainThreadException

This exception is thrown

...

以下是我在使用它们之后对两者的看法: JSch:最终更加灵活,但代价是低得多。 它也没有很好的记录(没有JavaDoc标签),但是非常稳定。 Ganymed:为您可能需要的大多数标准SSH操作(端口转发,反向端口转发,SCP文件复制等)提供良好的支持。 文档以主要公共类的Javadoc形式体面。 在我看来,最大的不同在于,Ganymed提供了一种更直观和封装的API,可直接映射到高级别的SSH操作。 //尼古拉斯 Here's my take on both after using them at

...

我从来没有使用过Ganymed ,只是通过查看我怀疑你过早发送密码的代码。 您可能需要处理服务器响应您的问题。 换句话说,服务器不会收到您认为收到的内容。 I've never used Ganymed but just by looking at the code I suspect that you send password too early. You probably need to handle what server responds to you. In other words s

...

在挖掘了源代码的相关部分后,我相当肯定答案是“你没有”。 将一个或多个文件名作为参数的所有put()方法最终都会调用私有的sendFiles()方法来实际发送文件。 此方法从每个文件名创建一个File对象,然后从每个文件创建一个FileInputStream对象。 果然, FileInputStream的构造函数抛出一个FileNotFoundException “如果该文件不存在, 是一个目录而不是一个常规文件 ,或者由于某些其他原因无法打开进行读取。” (并且,显然,它并不总是使用正确的错误消

...

你可能感兴趣的:(ganymed,ssh-2,for,java)