Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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 ?

like image 276
Swaroop Rath Avatar asked Nov 11 '14 04:11

Swaroop Rath


People also ask

What is Mina session?

Introduction. The Session is at the heart of MINA : every time a client connects to the server, a new session is created on the server, and will be kept in memory until the client is disconnected. If you are using MINA on the client side, every time you connect to a server, a session will be created on the client too.

What is Mina server?

Apache MINA (Multipurpose Infrastructure for Network Applications) is an open source Java network application framework. MINA can be used to create scalable, high performance network applications. MINA provides unified APIs for various transports like TCP, UDP, serial communication.


1 Answers

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.

like image 159
Hooli Avatar answered Sep 28 '22 00:09

Hooli