Mina SFTP : Has anyone attempted to use MINA as a SFTP server against Hadoop or a custom file system?

496 views Asked by At

Am trying to use Apache MINA as a SFTP server to a custom file system that is very similar to HDFS. Has anyone attempted anything like this before ?

Reading a directory, reading a file and writing to a file should be delegated to my custom methods.

1

There are 1 answers

0
Lukas Pokorny On

This has been definitely attempted before and some SFTP servers even define a custom file system API that make this easier. This seems to apply to Apache MINA SSHd as well.

I have done something similar in my SFTP/WS server for Node.js - one only needs to implement 18 methods to get full SFTP v3 support. These custom methods (see the IFilesystem interface as an example) correspond to SFTP protocol requests (packet types 3 to 20), which slightly resembles the POSIX API (there are some odd differences to look out for, however).

Although I don't have any experience with Apache MINA SSHd, it looks like this is possible as well. It provides an SshFile interface (it represents both a file and a directory, despite its name), which is used by MINA's SFTP subsystem, and provides "native" implementations that are used by default. In addition to this interface, there is FileSystemView interface (whose purpose is to resolve paths into instances of SshFile) and FileSystemFactory. I guess the authors actually had your scenario in mind - once you provide a custom implementation if MINA's SshFile (and related interfaces) that uses your custom file system instead of the "native" one, you are almost done.