Apache MINA SFTP - limit the directory structure that the user sees

1.6k views Asked by At

Am using Apache MINA SSHD to build my own custom SFTP Server.

I want to limit the file system my user sees. I just want them to see the directory structure under /aa/bb/cc

I do not want them to be able to see or navigate any other folder.

And from the directories under /aa/bb/cc, a user will have read access to some directories and write access to only a selected few. How do I achive this ?

1

There are 1 answers

0
Hooli On

The FileSystemView has been introduced for that very purpose. If you're using version 0.14.0, the following will work:

 sshServer.setFileSystemFactory(new VirtualFileSystemFactory(new File("admin").getAbsolutePath()));

I have also almost got a working example here. I just have to figure out how to set the home directory dynamically.