SHARE
Facebook X Pinterest WhatsApp

.htaccess Magic Page 3

Written By
thumbnail J.M. Ivler
J.M. Ivler
Oct 15, 1999
ServerWatch content and product recommendations are editorially independent. We may make money when you click on links to our partners. Learn More



Allowing and Disallowing Groups

Allowing and Disallowing Groups Grouping is a concept that allows a number of users to be established as part of a group. This allows a directory to be secured with a group access which lowers the amount of overhead for the person maintaining access. Let’s use the example above, where we want to add a new person to the area. There are two ways this can be done. The first, as outlined above, required that the .htaccess file be opened up and then the user added to that file. Then we had to create the user entry in the .htpasswd file.

Actually, you don’t want to be opening, closing, writing and rewriting the .htaccess file. Sure, it can be done, but we can drive cars off cliffs and we don’t do that just because it can be done. If there is an easier route, why not take it? That easier route is the group access file. In this case, we provide group access to the directory by changing the .htaccess file as follows:

AuthUserFile /pathto/passwdfile/.htpasswd
AuthGroupFile /pathto/groupfile/.htgroup
AuthName grouptest
AuthType Basic

require group the-group

In the file .htgroup, you would have a record that looked like:

the-group: user1 user2 user3 user4

where user1,user2, user3, and user4 were users who had entries in the .htpasswd file. Now, imagine a system where each month you add a new month-group to the .htaccess file in the require line. Then, if a user wants to be added, they could be added to the latest month-group in the .htgroup file and have an entry added in the .htpasswd file. Using this method, we are not having to access and update the .htaccess file at all, and it provides a clean and clear method of adding new people to the access list.

Also, using month-groups like the example method keeps the groups nicely compacted into a scheme that can be used to require people to re-access themselves to the system if you so choose. Another common grouping method is by first character and, since both Tcl and Perl have strong sort capabilities, this is also fairly easy to implement. Intranets and Internet: Some Differences and Considerations One of the key aspects of intranets deals with security. On intranets, there are usually documents and information that you don’t want to share with the outside world. For instance, it wouldn’t be very acceptable if someone from the outside world obtained access to your intranet white pages program, especially if that someone was a competitor, or worse yet, a headhunter.

Allowing and Disallowing Users
.htaccess Magic
Internets and Intranets

, an internet.com Web site.

Recommended for you...

What Is a Container? Understanding Containerization
What Is a Print Server? | How It Works and What It Does
Nisar Ahmad
Dec 8, 2023
6 Best Linux Virtualization Software for 2024
What Is a Network Policy Server (NPS)? | Essential Guide
ServerWatch Logo

ServerWatch is a top resource on servers. Explore the latest news, reviews and guides for server administrators now.

Property of TechnologyAdvice. © 2025 TechnologyAdvice. All Rights Reserved

Advertiser Disclosure: Some of the products that appear on this site are from companies from which TechnologyAdvice receives compensation. This compensation may impact how and where products appear on this site including, for example, the order in which they appear. TechnologyAdvice does not include all companies or all types of products available in the marketplace.