用于java连接问题的Ganymed SSH

时间:2012-12-14 10:42:34

标签: java ssh

我们正在使用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访问正常。

2 个答案:

答案 0 :(得分:0)

您的公钥可能存在问题

答案 1 :(得分:0)

在solaris 10上的141742-01 / 02补丁之后,ssh失败了!

启用ssh / sshd中的aes192 / aes256支持在S10u3或更早版本上无效

解决方法是禁用ses和sshd使用aes192 / aes256密码。更改两个配置文件/ etc / ssh / ssh_config和/ etc / ssh / sshd_config并添加以下行:

密码aes128-ctr,aes128-cbc,arcfour,3des-cbc,blowfish-cbc

您必须重新启动sshd以获取更改(“svcadm restart ssh”)。

来源: http://blog.mydream.com.hk/howto/matching-cipher-is-not-supported-aes256-cbc