JSch 连接到 ftp.secureftp-test.com

发布于 2024-10-15 00:16:12 字数 522 浏览 0 评论 0原文

因此,我使用了 http://www.jcraft.com/jsch/examples/ 上的示例Sftp.java 和我试图连接到 ftp.secureftp-test.com。

该目标是有效的测试 SFTP 服务器(如 secureftp-test dot com/ 中所述)。我通过 nautilus 连接到服务器确认了这一点。我还确保我的程序上的密码也正确。

但是,当我运行程序并点击 session.connect() 时,它只是显示“信息:已建立连接”,然后它会安静一分钟,然后返回: “com.jcraft.jsch.JSchException:连接被外部主机关闭”

我很确定它卡在了库的 while 循环中,但我不知道为什么。我在本地 ftp 服务器上尝试过,它也有同样的问题。

在安静的时刻,我可以打字。但按 Enter 键不会向服务器发送任何内容。

有人听说过或见过同样的问题吗?

So, I used the example on http://www.jcraft.com/jsch/examples/Sftp.java and I was trying to connect to ftp.secureftp-test.com.

That destination is a valid testing SFTP server (as mentioned in secureftp-test dot com/). I confirmed it by connecting to the server through nautilus. I also made sure that the password on my program was correct as well.

But, when I run the program and it hits session.connect(), it just says "INFO: Connection established" then it becomes quiet for a minute then it return:
"com.jcraft.jsch.JSchException: connection is closed by foreign host"

I am pretty sure that it got stuck in the while loop of the library but I do not know why. I tried it against my local ftp server and it also had the same problem.

During the quiet moment, I can type. But pressing enter does not send anything to the server.

Has anyone heard or seen the same problem?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

丘比特射中我 2024-10-22 00:16:12

好吧,看来 secureftp-test.com 不是 sftp 服务器。那就是ftps服务器。

我所做的是创建我自己的 sftp:
http://wiki.vpslink.com/Configuring_vsftpd_for_secure_connections_(TLS/SSL/SFTP) )

然后运行示例代码,但在执行 session.connect 之前确保我有这些行:

String knownHostsFilename = "/home/yourname/.ssh/known_hosts";
jsch.setKnownHosts(knownHostsFilename);

Okay, it seems that secureftp-test.com is NOT an sftp server. That is ftps server.

What I did instead was creating my own sftp:
http://wiki.vpslink.com/Configuring_vsftpd_for_secure_connections_(TLS/SSL/SFTP)

Then run the example code but making sure that I have these lines before doing session.connect:

String knownHostsFilename = "/home/yourname/.ssh/known_hosts";
jsch.setKnownHosts(knownHostsFilename);
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文