Guides.htaccess Magic Page 3

.htaccess Magic Page 3

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 Web site.

Get the Free Newsletter!

Subscribe to Daily Tech Insider for top news, trends & analysis

Latest Posts

Related Stories