简体   繁体   English

ftps-无法获得数据连接

[英]ftps- unable to get data connection

i am trying to connect to an ftp server using ssh/tls but every method i have used hasn't been helpful. 我正在尝试使用ssh / tls连接到ftp服务器,但我使用的每个方法都没有用。

    FTPSClient ftpsClient = new FTPSClient("TLS", false);
   // log.debug("using TLS");
    FTPClientConfig ftpClientConfig = new FTPClientConfig(FTPClientConfig.SYST_UNIX);
    ftpClientConfig.setServerLanguageCode("de");
    ftpsClient.configure(ftpClientConfig);
    ftpsClient.addProtocolCommandListener(new PrintCommandListener(new PrintWriter(System.out))); // outputs all conversation to the console
    ftpsClient.connect(domain, 21);
    // Set protection buffer size
    ftpsClient.execPBSZ(0);
    // Set data channel protection to private
    ftpsClient.execPROT("P");
    ftpsClient.login(username, password);
    ftpsClient.enterLocalPassiveMode();
    ftpsClient.changeWorkingDirectory(filepath);
    ftpsClient.execPBSZ(0);
    // Set data channel protection to private
    ftpsClient.execPROT("P");
    ftpsClient.listFiles();
    ftpsClient.logout();

but i keep getting the same error- 但我一直得到同样的错误 -

250 CWD command successful
PBSZ 0
200 PBSZ 0 successful
PROT P
200 Protection set to Private
PASV
227 Entering Passive Mode (188,65,181,123,23,20).
LIST
150 Opening ASCII mode data connection for file list
425 Unable to build data connection: Operation not permitted
TLS
QUIT
221 Goodbye.

From what I have gathered through searching the web, this is caused by the ftp server wanting the client to use the same session for both commands and data transfer. 从我通过搜索网络收集的内容来看,这是由于ftp服务器希望客户端为命令和数据传输使用相同的会话。

The current work around is to change the server config so that it doesn't enforce session reuse.For ProFtp the config are explained on this link http://www.proftpd.org/docs/howto/TLS.html . 目前的解决方法是更改​​服务器配置,以便它不会强制执行会话重用。对于ProFtp,配置在此链接http://www.proftpd.org/docs/howto/TLS.html上进行了解释。

Unfortunately I could not find where one can tell their java client to reuse the session for data transfer. 不幸的是,我无法找到可以告诉他们的Java客户端重用会话进行数据传输的地方。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM