[英]Apache MINA SFTP - limit the directory structure that the user sees
Am using Apache MINA SSHD to build my own custom SFTP Server. 我使用Apache MINA SSHD来构建我自己的自定义SFTP服务器。
I want to limit the file system my user sees. 我想限制用户看到的文件系统。 I just want them to see the directory structure under /aa/bb/cc
我只是希望他们在/ 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. 从/ aa / bb / cc下的目录中,用户将具有对某些目录的读访问权限,并且只能对所选择的几个目录进行写访问。 How do I achive this ?
我怎么做到这一点?
The FileSystemView has been introduced for that very purpose. FileSystemView就是出于这个目的而引入的。 If you're using version
0.14.0
, the following will work: 如果您使用的是版本
0.14.0
,则以下内容将起作用:
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.
我只需要弄清楚如何动态设置主目录。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.