Tri*_*tan 6 webdav mod-webdav apache-2.2
我设置了一个 WebDAV 用户,该用户当前从我的 MySQL 数据库中获取用户名和密码。我为用户提供了使用 WebDAV 上传大文件的选项(这是我目前正在开发的文件共享服务),但我遇到了一个我似乎无法弄清楚的小问题。
首先 - 我将如何处理每个拥有自己的 WebDAV 根的用户,以便他们无法查看其他用户的文件?我已经运行了一个 cronjob,它检查启用了 WebDAV 的所有用户并自动创建具有适当权限的目录。我只需要一些告诉 apache 的方法。
感谢您的帮助,我真的很感激。
我也知道我可以每分钟运行一次 cronjob 来生成我的 apache 配置并重新加载 apache 配置,但这只是有点太多的开销,我想要更多的灵活性。
小智 0
据我所知(2-3年前),您需要添加每个用户/目录配置。
# cat /etc/apache2/conf.d/dav_store.conf
# First you need to say that a share under location X will be a webdav share:
Alias /store /home/davfs/storage/
<Directory /home/davfs/storage/>
DAV On
AuthType Basic
AuthName "sample"
Auth_MySQL On
Auth_MySQL_Authoritative On
Auth_MySQL_Host localhost
Auth_MySQL_User _admin
Auth_MySQL_Password 123
Auth_MySQL_DB dav
Auth_MySQL_Password_Table auth_user
Auth_MySQL_Username_Field username
Auth_MySQL_Password_Field password
Auth_MySQL_Empty_Passwords Off
Auth_MySQL_Encryption_Types Django #This was custom.
#AuthMySQLUserCondition = "is_active = 1"
# non root users cannot view this directory
Options -Indexes -MultiViews
AllowOverride None
require user root;
</Directory>
<Directory /home/davfs/storage/*/>
DAV On
require user root;
</Directory>
Include /home/davfs/etc/conf.d/*.dvu
Run Code Online (Sandbox Code Playgroud)
每个用户的配置文件将用户锁定到一个目录。这是一个示例
<Directory /home/davfs/storage/lm/lmwangi/>
# We need this in subdirs.. otherwise error messages such as
# "DAV Off" cannot be used to turn off a subtree of a DAV-enabled location.
# will fill up your log
DAV On
require user lmwangi
</Directory>
Run Code Online (Sandbox Code Playgroud)
这就是全部内容。我认为你必须在每次配置更改时重新加载 Apache。如果这些任务可以使用 Apache 模块来完成,那就太好了...(不再需要 cron 来生成配置,不再需要重新加载等)
归档时间: |
|
查看次数: |
10343 次 |
最近记录: |