Apache 要求用户不阻止其他用户访问

Apache 要求用户不阻止其他用户访问

我创建了一个子文件夹并想限制特定用户(“michael_mayer”)的访问权限。

# User Michael Mayer
Alias /michael_mayer /var/www/webdav/users/michael_mayer
<Directory /var/www/webdav/users/michael_mayer>
    DAV             On
    AuthType        Basic
    AuthName        "Michael Mayer Directory"
    AuthUserFile /etc/apache2/users.password
    Require         valid-user
</Directory>

#Require valid-user means that everybody with a valid username+pass can access it

<Location /michael_mayer/>
    Require    michael_mayer
</Location>

但是我仍然可以访问该文件夹

/var/www/webdav/users/michael_mayer

与不同的用户,所以我想我打错了或忘记了其他内容。

有经验的人能看看我的脚本中是否有错误吗?

谢谢你!

答案1

因为在第一个目录配置中:

Require         valid-user

该文件中的任何用户都被视为有效。将“valid-user”更改为“michael_mayer”即可正常工作。

此外,‘要求' 指令在 'Location' 上下文中无效。您只能在 'Directory' 上下文或 .htaccess 文件中使用 require 设置(如果启用了 AllowOveride)。您的 'Location' 配置是多余的。

相关内容