mjpclab / go-http-file-server

Simple command line based HTTP file server to share local file system
MIT License
379 stars 55 forks source link

请教一下,有没有办法设置一个文件夹,允许匿名访问,但是必需验证后才能上传和新建文件夹? #27

Closed troilus closed 8 months ago

troilus commented 1 year ago

我采取了软连接的方式貌似可以了: server目录下有private和public两个文件夹 private 文件夹设置了auth-dir、upload-dir、delete-dir、mkdir-dir,这样一来必需登录,登录后才能上传等操作 然后创建了一个private/share指向public的软连接,ln -s /home/user/server/private/share /home/user/server/public 这样一来上传到private/share文件夹的文件就显示在URL/public中了

请教下这样安全性没什么问题吧?谢谢!

marjune163 commented 1 year ago

这样是可以达到分离权限的目的,没问题。不过安全是个大话题,还是要提高警惕。

marjune163 commented 1 year ago

~~EHFS 增加了权限设置相关功能,可以参考: https://github.com/mjpclab/extra-http-file-server/releases/tag/v1.15.11~~

~~例如 ehfs -r /home/user/server/ --perms-dir :/home/user/server/private:upload,mkdir,delete:username~~

marjune163 commented 8 months ago

1.17.0增加了更改相关的权限设置,但必须显式指定允许的用户列表,详见https://github.com/mjpclab/go-http-file-server/releases/tag/v1.17.0