Protecting Web pages with passwords

Configuration files for password protection

You can restrict access to a specified directory so that only specified users or groups have access to it.

Password protection involves three configuration files:

The /etc/httpd.access file

The /etc/httpd.access file contains directives that govern authentication for each directory. The filer supports the following directives:

These directives are compatible with the Apache Web server directives, but the filer ignores all other directives.

The directory directive

Specifies a directory tree to be protected and encloses all other directives. The syntax of the directory directive is as follows:

<Directory directory_name>
directive ...
</Directory>
The AuthName directive

Specifies a "realm," that is, an alias for the directory that appears instead of the directory name in the browser's password dialog box when a user tries to access the directory. Whatever follows AuthName is the name of the realm. The name of the realm can contain spaces. The syntax of the AuthName directive is as follows:

AuthName realm name
The require user directive

Specifies the users who can access the directory. The syntax of the require user directive is as follows:

require user user_id [, user_id, ... ]
The require group directive

Specifies the groups that can access the directory. The syntax of the require group directive is as follows:

require group group_id [, group_id, ... ]

The /etc/httpd.passwd file

The /etc/httpd.passwd file contains the user_id and encrypted-password pairs. The pairs have the following format:

user_id:encrypted_passwd

The pairs are copied in from a machine on which the user has a password.

The /etc/httpd.group file

The /etc/httpd.group file contains a group_id and a list of user_ids in that group in the following format:

group_id: user_id [user_id  ....]

The lists are copied in from a machine that has a similar list.

Web page protection examples

The following /etc/httpd.access file restricts access to /vol/vol0/home/htdocs/private/spec to only the user bob:

<Directory /vol/vol0/home/htdocs/private/spec>
AuthName polard Private Stuff
<Limit GET>
require user bob
</Limit GET>
</Directory>

The <Limit GET> and </Limit GET> directives, which might have been imported from an Apache or NCA Web server, are not supported. To be used on a filer, the file does not need to be edited to remove the Limit GET directive; the filer ignores the directive and all other directives not mentioned in this chapter.

The following sample procedure restricts user access to a particular directory:

  1. Enter the following lines in the /etc/httpd.access file:
<Directory /vol/vol0/home/htdocs/private/specs>
AuthName Social commentary
require group engineering
</Directory>
  1. Enter the following line in /etc/httpd.group:
engineering: bob larry nancy rose

The /vol/vol0/home/htdocs/private/specs directory is now accessible only to the group engineering, which consists of the following user IDs:


Copyright © 1999, Network Appliance, Inc. All rights reserved.

Part No. 210-02334
File: http2.htm
Last updated: 02/24/99 12:16:45