Free SFTP Plugin Announced

Attached is a free Servoy plugin to handle uploading and downloading files on your App server. You must have SSH running and the port opened (if firewall) on your app server for this plugin to work (since that is how it transfers the files). This is not a bean…it is only a plugin, so all commands are sent via methods.

You can see an example my doing a move sample on the “put” or “get” method. This plugin will support authenticate through username & password, or a public key string.

INSTALL:
There are 2 files in the attached zip. Put the j2ssh-core.jar in the Servoy lib folder (/Servoy/lib) and the sftp.jar in the Servoy plugins folder (/Servoy/plugins).

NOTE: THIS PLUGIN IS AS IS, NO WARRANTY - YOU’RE ON YOUR OWN - MAKE BACKUPS IF NEEDED.

UPDATE: This plugin will be added to the free IT2Be suite. IT2BE will be able to provide support for this plugin. Please contact Marcel with any questions. For now, I have removed the download so we don’t cause any confusion. You can expect a message from Marcel within a few weeks.

Thanks Scott, this looks really handy!

Just so you know, the plug-in is already added to the framework.
I will do a little polishing and need to finish some other stuff but it will become available beginning next week.

Hi Marcel and Scott, thanks for making this available to the Servoy community.

Could you give an example or explanation of the use of plugins.it2be_ftp.createSSHClient(). The examples for list/put/get don’t use it.

Also, is it possible to issues FTP commands such as CWD, MKD, RNFR, RNTO, DELE.

Regards,

Tony, I am pretty sure the createSSHClient() method is of no additional use.
It is internally used to build the connection.

The commands you would like to use are terminal commands and are not supported as far as I have seen in the documentation.

What I could do is add:

  • mkdir
  • mkdirs
  • rm
  • rename

Even without adding it to the bugtracker as a feature request ( :) ), available with the next release:

[new] added method ‘mkdir’
[new] added method ‘mkdirs’
[new] added method ‘rename’
[new] added method ‘chmod’
[new] added method ‘rm’
[new] added method ‘getWorkingPath’

Thanks for the speedy response Marcel. These are useful additions.

If possible, it would be great to include a command to change the current directory.

I knew it, you are always able to find something extra…

But why would you want that, these are single sessions…

Marcel, not something extra - it was first on my list! I appreciate the plugin is a freebie and your suggested improvements to make/rename/delete folders, rename and delete files, and change permissions will add functionality and cover all the other suggested additions, thanks :-)

It wasn’t clear from the examples that these are single sessions - cleanUp() and createSSHClient() and the tip ‘remember to disconnect’ suggested the creation of persisting sessions, leading me to contribute the suggestion that terminal-like commands - even a generic one like sendFtpCommand(string) - would be quicker and more efficient than a series of single sessions. Seems I misunderstood… Nowhere better to sort that out, and noone better to ask!

Thanks again for this excellent addition.

Hi Tony,

I could make the sessions persistent if that helps you do what you want to achieve but that would not make it into the next release because it requires restructuring.

When you want this to happen please make it a feature request.

Thanks Marcel, will do that.

For now, is cleanUp() required, and if so, what does it do?

I am not sure. Since the session is not persistent I would ignore it.

Will investigate when I work on a new version.

Does anyone know of a plugin (not a bean) that handles plain FTP (of the Port 21 variety with no need for SSH on the FTP server)? It seems this one is just for secure FTP.

Thanks in advance.

There was one but it looks like it is taken off-line.

You can add a feature request to our bugtracker and I will start implementing it asap. I already downloaded some libs for it.

When somebody has already started something like this I am more than willing to integrate it in the free ftp plug-in for the benefit of everybody!

Thanks for the speedy response Marcel! It’s added now.

I think I have something like that. Maybe we get in touch, Marcel…

OK, we can skype!

Thanks to Patrick I already have some code for the plug-in now.
It should be possible to integrate this soon :)

I was wondering what’s the usage of the .mechanism property in the sftpSettings array?

The mechanism property returns that the settings use a password (value = 1) or a public key (value = 2).