尝试通过 Jsch 连接到 SFTP 服务器,我正在使用 com.github.mwiede:jsch:0.1.72 出现以下错误:
session.connect()
。
我检查了另一个SO(JSchException:算法协商失败),但潜在的错误是不同的。 Jsch日志如下:
Connecting to SERVER_NAME port 22
INFO: Connection established
INFO: Remote version string: SSH-2.0-Serv-U_15.4.2.157
INFO: Local version string: SSH-2.0-JSCH-0.1.72
INFO: CheckCiphers: [email protected]
INFO: CheckKexes: curve25519-sha256,[email protected],curve448-sha512
INFO: CheckSignatures: ssh-ed25519,ssh-ed448
DEBUG: server_host_key proposal before known_host reordering is: ssh-ed25519,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,rsa-sha2-512,rsa-sha2-256,ssh-rsa
DEBUG: server_host_key proposal after known_host reordering is: ssh-ed25519,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,rsa-sha2-512,rsa-sha2-256,ssh-rsa
INFO: SSH_MSG_KEXINIT sent
INFO: SSH_MSG_KEXINIT received
INFO: kex: server: ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group1-sha1,diffie-hellman-group14-sha1,diffie-hellman-group14-sha256,diffie-hellman-group16-sha512,diffie-hellman-group-exchange-sha256
INFO: kex: server: ssh-dss
INFO: kex: server: aes128-cbc,rijndael128-cbc,aes192-cbc,rijndael192-cbc,aes256-cbc,rijndael256-cbc,[email protected],[email protected],aes128-ctr,aes192-ctr,aes256-ctr
INFO: kex: server: aes128-cbc,rijndael128-cbc,aes192-cbc,rijndael192-cbc,aes256-cbc,rijndael256-cbc,[email protected],[email protected],aes128-ctr,aes192-ctr,aes256-ctr
INFO: kex: server: hmac-md5,hmac-sha1,hmac-sha1-96,hmac-sha2-256,hmac-sha2-256-96,hmac-sha2-512,hmac-sha2-512-96
INFO: kex: server: hmac-md5,hmac-sha1,hmac-sha1-96,hmac-sha2-256,hmac-sha2-256-96,hmac-sha2-512,hmac-sha2-512-96
INFO: kex: server: zlib,none
INFO: kex: server: zlib,none
INFO: kex: server:
INFO: kex: server:
INFO: kex: client: curve25519-sha256,[email protected],ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group14-sha256,ext-info-c
INFO: kex: client: ssh-ed25519,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,rsa-sha2-512,rsa-sha2-256,ssh-rsa
INFO: kex: client: aes128-ctr,aes192-ctr,aes256-ctr,[email protected],[email protected]
INFO: kex: client: aes128-ctr,aes192-ctr,aes256-ctr,[email protected],[email protected]
INFO: kex: client: [email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-sha1
INFO: kex: client: [email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-sha1
INFO: kex: client: none
INFO: kex: client: none
INFO: kex: client:
INFO: kex: client:
INFO: Disconnecting from SERVER_NAME port 22
我能够通过以下设置解决此问题:
session.setConfig("kex", session.getConfig("kex") + ",diffie-hellman-group1-sha1")
session.setConfig("server_host_key", session.getConfig("server_host_key") + ",ssh-dss")