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

I use Apache MINA SSHD to create my own custom SFTP server.

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

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

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

+5
source share
1 answer

FileSystemView was introduced for this purpose. If you are using version 0.14.0 , the following will work:

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

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

0
source

Source: https://habr.com/ru/post/1206601/


All Articles