Swaroop Rath
Swaroop Rath

Reputation: 141

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 ?

Upvotes: 6

Views: 1689

Answers (1)

Hooli
Hooli

Reputation: 1195

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.

Upvotes: 2

Related Questions