Apache2 中是否可以有两个密码文件? [英] Is it possible to have two password files in Apache2?

查看:41
本文介绍了Apache2 中是否可以有两个密码文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以在 apache2/sites-enabled/000-default 配置文件中有两个 AuthUserFile 指令吗?

Can I have two AuthUserFile directives in an apache2/sites-enabled/000-default configuration file?

    <Location /repo/trac>
      AuthType Basic
      AuthName "Trac"
      AuthUserFile /etc/apache2/passfile1
      AuthUserFile /etc/apache2/passfile2
      Require valid-user
    </Location>

我想要两种类型的用户的用户名/密码.

I want username/password for two types of users.

  • DEV - 可以访问 SVN 和 Trac
  • NOM - 只能访问 Trac

我有两个选择:为 Trac 和 Svn 保留单独的密码文件并分别包含它们,或者将 2 个密码文件合二为一我将 DEV 放在其他 NOM 中,只包含 1 个用于 svn 并在 trac 位置下包含两个.

I have two options: keep separate password files for Trac and Svn and include them separately, or have 2 password files in 1 I put DEV in other NOM and include only 1 for svn and include two under trac location.

推荐答案

您应该将所有内容移动到一个密码文件中,然后使用组来控制对特定资源的访问.您可以使用以下内容创建 /etc/apache2/groups:

You should move everything into a single password file and then use groups to control access to particular resources. You can create /etc/apache2/groups with contents along the lines of:

DEV: bob alice
NOM: norm fred bart

然后修改您的配置,使其看起来像这样:

And then modify your configuration so it looks like this:

<Location /repo/trac>
  AuthType Basic
  AuthName "Trac"
  AuthUserFile /etc/apache2/passfile
  AuthGroupFile /etc/apache2/groups
  Require group DEV NOM
</Location>

这将允许 DEVNOM 组的成员访问此资源.

This would allow members of the DEV and NOM groups to access this resource.

如果您真的想要使用多个密码文件,请参阅文档mod_authn_alias,它有一个例子就是这样做的.

If you really want to use multiple password files, see the documentation for mod_authn_alias, which has an example that does exactly this.

这篇关于Apache2 中是否可以有两个密码文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆