简体   繁体   中英

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 ?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM