Using Require to Authorize Users and Groups


Using Require to Authorize Users and Groups

<Directory /usr/local/apache2/htdocs/private>     AuthType Basic     AuthName "Password Protected Area"     AuthUserFile /usr/local/apache2/conf/htusers     AuthGroupFile /usr/local/apache2/conf/groups     Require group administrators </Directory>


You can instruct Apache to allow access to any valid user in the database that successfully authenticates with

Require valid-user


If you need to authorize only a certain group of users, you can explicitly list them in the arguments to Require:

Require user userid1 userid2


If you have a great number of users, a more convenient way to accomplish this is to use the AuthGroupFile directive. This directive points to a file containing group information in the following format:

groupname: userid1 userid2 userid3 [..]


For example

administrators: admin boss users: admin boss user1 user2


The example at the beginning of this section shows a configuration snippet that allows access only to those users that successfully authenticate themselves and also belong to the group administrators. In this example, that would mean users admin and boss.




Apache(c) Phrase Book(c) Essential Code and Commands
Apache Phrasebook
ISBN: 0672328364
EAN: 2147483647
Year: 2006
Pages: 254

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net