Enable logging in Apache Commons Net for FTP protocol

All protocol implementations in Apache Commons Net, including FTPClient, derive from SocketClient, which has a method addProtocolCommandListener. You can pass it an implementation of ProtocolCommandListener to implement logging. There’s a ready-made implementation PrintCommandListener, which prints the protocol log to provided PrintStream. With a code like this: ftpClient.addProtocolCommandListener( new PrintCommandListener( new PrintWriter(new OutputStreamWriter(System.out, “UTF-8”)), true)); …, … Read more

How to connect to FTPS server with data connection using same TLS session?

Indeed some FTP(S) servers do require that the TLS/SSL session is reused for the data connection. This is a security measure by which the server can verify that the data connection is used by the same client as the control connection. Some references for common FTP servers: vsftpd: https://scarybeastsecurity.blogspot.com/2009/02/vsftpd-210-released.html FileZilla server: https://svn.filezilla-project.org/filezilla?view=revision&revision=6661 ProFTPD: http://www.proftpd.org/docs/contrib/mod_tls.html#TLSOptions (NoSessionReuseRequired … Read more