Question

I am writing a JAVA program for work that at some point needs to transfer files from the machine it is running on to another machine. The requirements are such that it can be configured to either do the transfer over FTP, SFTP, or a connection where the authentication is secure but data is transferred unencrypted.

Implementing the first two shouldn't be too bad with third party JAVA libraries. The issue I am having is with the third option. Seems like the only way to do that is by tunneling FTP over SSH.

As I am fairly inexperienced in this matter, wondering if anyone has any helpful suggestions. This can be done using either a reliable JAVA library (preferred) or some other tool that I just call as a separate process from within the program.

thanks

Was it helpful?

Solution

You can use Apache Commons VFS for file uploads and downloads. There is FTP and FTPS. The only prerequisite is that your remote system must run an FTP server. You do not have to call some external process. Just make your own application do the work. Remember to be careful with firewalls.

With FTPS only the control session is guaranteed to be encrypted. The data is transfered via regular FTP. Whether it is encrypted or not is up to you. You can use the PROT and CDC commands to control encryption.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top