JSch是SSH2的纯Java实现。 JSch允许您连接到SSH服务器并使用端口转发,X11转发,文件传输等,您可以将其功能集成到您自己的Java程序中。
我尝试通过Java连接SFTP服务器。 我收到一个错误。 com.jcraft.jsch.JSchException:算法协商失败 这是 POM: com.jcraft 我尝试通过Java连接SFTP服务器。 我遇到错误。 com.jcraft.jsch.JSchException:算法协商失败 这是 POM: <dependency> <groupId>com.jcraft</groupId> <artifactId>jsch</artifactId> <version>0.1.53</version> </dependency> 这是日志: INFO: Connecting to **"FTP ADRESS"** port 22 INFO: Connection established INFO: Remote version string: SSH-2.0-Maverick_SSHD INFO: Local version string: SSH-2.0-JSCH-0.1.53 INFO: CheckCiphers: aes256-ctr,aes192-ctr,aes128-ctr,aes256-cbc,aes192-cbc,aes128-cbc,3des-ctr,arcfour,arcfour128,arcfour256 INFO: aes256-ctr is not available. INFO: aes192-ctr is not available. INFO: aes256-cbc is not available. INFO: aes192-cbc is not available. INFO: CheckKexes: diffie-hellman-group14-sha1,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521 INFO: diffie-hellman-group14-sha1 is not available. INFO: ecdh-sha2-nistp256 is not available. INFO: ecdh-sha2-nistp384 is not available. INFO: ecdh-sha2-nistp521 is not available. INFO: CheckSignatures: ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521 INFO: ecdsa-sha2-nistp256 is not available. INFO: ecdsa-sha2-nistp384 is not available. INFO: ecdsa-sha2-nistp521 is not available. INFO: SSH_MSG_KEXINIT sent INFO: SSH_MSG_KEXINIT received INFO: kex: server: diffie-hellman-group1-sha1,diffie-hellman-group-exchange-sha1 INFO: kex: server: ssh-rsa INFO: kex: server: aes256-cbc,aes192-cbc INFO: kex: server: aes256-cbc,aes192-cbc INFO: kex: server: hmac-sha1,hmac-sha1-96 INFO: kex: server: hmac-sha1,hmac-sha1-96 INFO: kex: server: none INFO: kex: server: none INFO: kex: server: INFO: kex: server: INFO: kex: client: diffie-hellman-group-exchange-sha256,diffie-hellman-group-exchange-sha1,diffie-hellman-group1-sha1 INFO: kex: client: ssh-rsa,ssh-dss INFO: kex: client: aes128-ctr,aes128-cbc,3des-ctr,3des-cbc,blowfish-cbc INFO: kex: client: aes128-ctr,aes128-cbc,3des-ctr,3des-cbc,blowfish-cbc INFO: kex: client: hmac-md5,hmac-sha1,hmac-sha2-256,hmac-sha1-96,hmac-md5-96 INFO: kex: client: hmac-md5,hmac-sha1,hmac-sha2-256,hmac-sha1-96,hmac-md5-96 INFO: kex: client: none INFO: kex: client: none INFO: kex: client: INFO: kex: client: INFO: Disconnecting from "FTP ADRESS" port 22 我遇到了这个错误,我试图修复它。我无法访问 SFTP 服务器来下载或更新任何文件等... 我可以通过FileZilla连接服务器,但我无法通过Java连接服务器。 连接代码: JSch jsch = new JSch(); Properties config = new Properties(); config.put("cipher.s2c", "aes128-ctr,aes128-cbc,3des-ctr,3des-cbc,blowfish-cbc,aes192-ctr,aes192-cbc,aes256-ctr,aes256-cbc"); config.put("cipher.c2s", "aes128-ctr,aes128-cbc,3des-ctr,3des-cbc,blowfish-cbc,aes192-ctr,aes192-cbc,aes256-ctr,aes256-cbc"); config.put("kex", "diffie-hellman-group1-sha1,diffie-hellman-group14-sha1,diffie-hellman-group-exchange-sha1,diffie-hellman-group-exchange-sha256"); Session jschSession = jsch.getSession("username","server",22); jschSession.setConfig("StrictHostKeyChecking", "no"); jschSession.setPassword("password"); jschSession.setConfig(config); jschSession.connect(); 当我添加时 config.put("cipher.s2c", "aes128-ctr,aes128-cbc,3des-ctr,3des-cbc,blowfish-cbc,aes192-ctr,aes192-cbc,aes256-ctr,aes256-cbc"); 日志是这样的 INFO: Connecting to ftp.servername port 22 INFO: Connection established INFO: Remote version string: SSH-2.0-Maverick_SSHD INFO: Local version string: SSH-2.0-JSCH-0.1.53 INFO: CheckCiphers: aes256-ctr,aes192-ctr,aes128-ctr,aes256-cbc,aes192-cbc,aes128-cbc,3des-ctr,arcfour,arcfour128,arcfour256 INFO: aes256-ctr is not available. INFO: aes192-ctr is not available. INFO: aes256-cbc is not available. INFO: aes192-cbc is not available. INFO: CheckKexes: diffie-hellman-group14-sha1,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521 INFO: diffie-hellman-group14-sha1 is not available. INFO: ecdh-sha2-nistp256 is not available. INFO: ecdh-sha2-nistp384 is not available. INFO: ecdh-sha2-nistp521 is not available. INFO: CheckSignatures: ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521 INFO: ecdsa-sha2-nistp256 is not available. INFO: ecdsa-sha2-nistp384 is not available. INFO: ecdsa-sha2-nistp521 is not available. INFO: SSH_MSG_KEXINIT sent INFO: SSH_MSG_KEXINIT received INFO: kex: server: diffie-hellman-group1-sha1,diffie-hellman-group-exchange-sha1 INFO: kex: server: ssh-rsa INFO: kex: server: aes256-cbc,aes192-cbc INFO: kex: server: aes256-cbc,aes192-cbc INFO: kex: server: hmac-sha1,hmac-sha1-96 INFO: kex: server: hmac-sha1,hmac-sha1-96 INFO: kex: server: none INFO: kex: server: none INFO: kex: server: INFO: kex: server: INFO: kex: client: diffie-hellman-group1-sha1,diffie-hellman-group-exchange-sha1,diffie-hellman-group-exchange-sha256 INFO: kex: client: ssh-rsa,ssh-dss INFO: kex: client: aes128-ctr,aes128-cbc,3des-ctr,3des-cbc,blowfish-cbc INFO: kex: client: aes128-ctr,aes128-cbc,3des-ctr,3des-cbc,blowfish-cbc INFO: kex: client: hmac-md5,hmac-sha1,hmac-sha2-256,hmac-sha1-96,hmac-md5-96 INFO: kex: client: hmac-md5,hmac-sha1,hmac-sha2-256,hmac-sha1-96,hmac-md5-96 INFO: kex: client: none INFO: kex: client: none INFO: kex: client: INFO: kex: client: INFO: Disconnecting from ftp.servername port 22 com.jcraft.jsch.JSchException: Algorithm negotiation fail 如您所见,服务器提供以下密码: 信息:kex:服务器:aes256-cbc,aes192-cbc 但是 JSch 只接受这些: 信息:kex:客户端:aes128-ctr,aes128-cbc,3des-ctr,3des-cbc,blowfish-cbc 没有通用密码可供选择。 请注意,JSch 确实支持 aes256-cbc 和 aes192-cbc,但需要 JCE(Java 加密扩展)才能允许它们。 您可能没有 JCE,因此这些密码不可用。这就是为什么有 信息:aes256-cbc 不可用。 下载 Java Cryptography Extension (JCE) Unlimited Strength Jurisdiction Policy Files 8(或其他版本,如果是其他 JDK – 1.7、1.6、IBM JDK 1.6)。 另请参阅密码“aes256-cbc”是必需的,但它不可用。 我通过将以下行添加到 /etc/ssh/sshd_config 并重新启动 sshd 服务来解决这个问题。感谢@wierzbiks 在另一个线程中的回答 KexAlgorithms [email protected],ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group14-sha1,diffie-hellman-group-exchange-sha1,diffie-hellman-group1-sha1 我解决了这个问题,将库 jsch-0.1.27.jar 更新为 jsch-0.1.54.jar。 最后在你的代码中你应该写这样的东西: your Method { session.setConfig("StrictHostKeyChecking", "no"); // That solve the problem. } 如果您需要此 Java 版本,此代码适用于 Java 1.5 或更高版本。
JSch ssh_rsa_verify:SSH_MSG_KEX_DH_GEX_REPLY 上的签名为假
我正在尝试进行公钥/私钥授权,但它仅适用于某些服务器。 下面的代码在连接到本地按位服务器以及连接到本地 CrushFTP 时有效...
私有字符串用户=“root”, 新密码 = "test123"; 私有 int 端口 = 22; 公共 SSHConnection(字符串主机,字符串密码){ 尝试 { JSch jsch = new JSch();
JSch 0.1.53 session.connect() 抛出“IO 流读取结束”
我下载了新的 JSch 0.1.53 库,JSch (sftp) 下载任务不再起作用。此版本在 session.connect() 函数上失败,抛出错误 Session.connect: java.io.IOException: End of...
我正在尝试连接到无法通过 JSch 管理的远程设备,尽管我可以使用具有相同凭据的 WinSCP 客户端进行连接。 该应用程序是基于 J2EE 的企业应用程序...
使用 JSch 创建通过 SSH 隧道传输的 SOCKS 代理
据我所知,可以使用 JSch 创建 SSH 隧道,然后将 Firefox 中的设置作为 SOCKS5 代理,所有流量将通过 JSch 连接的机器...
无法使用 JSch 将文件上传到 SFTP 服务器 - 没有此类文件 (SftpException)
我正在尝试连接到 SFTP 服务器并上传文件。就我而言,我必须使用代理并使用私钥进行身份验证。我还获得了文件需要存放的特定位置...
使用 JSch 执行的“sudo”命令需要密码,即使在交互式 SSH 会话中不需要密码
从 Linux 命令 shell 中,我可以使用用户 ABC 与我们的 CentOS 计算机建立 SSH 连接。 SSH 连接成功后,我可以运行 sudo 命令,并且不需要密码。 sudo /usr/bin/rootsh -...
jsch JSchAlgoNegoFailException 算法协商失败
使用jsch-0.2.17.jar 我可以使用 WINSCP 连接,但不能使用 jsch 我正在设置这些属性: config.put("StrictHostKeyChecking", "否"); config.put("PubkeyAcceptedAlgorithms...
我正在使用 JSch 连接到由 GWT 制作的网站中的 SFTP。 我读过 sftpChannel.get()、sftpChannel.rename()、sftpChannel.rm() 的一个小例子 但我没有找到解决方案...
Gerrit 触发器因 com.jcraft.jsch.JSchAlgoNegoFailException 而失去连接
Gerrit Trigger 插件以前运行良好,但从我无法弄清楚的时间点开始,永远无法建立连接,并显示以下错误消息: 连接错误:com.jcraft。
我在我的 ColdFusion 应用程序中使用这个 JSch 库 (http://www.jcraft.com/jsch/)。我的应用程序想要实现重试机制 - 如果文件传输中途失败,那么我想要
从远程 FTP 站点下载接近 2 GB 大小的文件时,我们看到以下错误且无法继续。有趣的是文件被下载,但可能在最后阶段它
我有 SFTP 密钥对文件的内容作为字符串。我需要使用 JSch 添加内容,但 addIdentity 只接受文件路径。无论如何我可以做到这一点吗? 我看到 KeyP...
使用 JSch SSH 连接的 Android VpnService:它连接到服务器,但无法访问互联网
我正在使用下面的源通过 SSH 连接到服务器。程序中没有任何错误。 钥匙图标将出现在手机屏幕顶部: VPN 连接图像 1。 但我没有
将 Jenkins 从 Java 1.8.x.x 更新到 1.11.x.x 并将 Jenkins LTS 版本从 2.3xx.x 更新到 2.4xx.x 后,按照管理插件建议更新了所有插件。 构建后操作“S...
JSch 连接问题:JSchException:算法协商失败 – 即使安装了 JCE
我正在尝试使用 JSch 连接到服务器,但它出现连接问题。我可以使用 PuTTY 连接到服务器,但不能使用 Java 代码。 我使用的是jdk1.8.0_171 这是代码...
使用 Apache VFS 时如何在 JSch 会话上设置 KEX
我正在使用 Apache VFS 2.1 和 JSch 0.1.54(今天的最新版本)来使用 SFTP 上传文件。 连接时系统抛出“End of IO Stream Read”,完整的堆栈为: 原因是:...
JSchException:验证:在使用 Apache Mina SSHD 服务器进行本地测试期间为 false
我正在为基于 Jsch 的 FTP 客户端编写 TestNG 测试,但我不断收到以下错误: com.jcraft.jsch.JSchException:验证:false 在 com.jcraft.jsch.Session.connect(Session.java:330) 在com....
使用 JSch 连接到 VShell 时出现“1024 到 1024 之间没有合适的素数可用”
我已经使用 JSch 编写了一个客户端(通过基于用户名密码的日志记录)。 以下是相关代码行:- sshSession = jsch.getSession(用户名, 主机, 22); sshSession.setConfig("