Require user per vhost

Giganews Newsgroups
Subject: Require user per vhost
Posted by:  Steve (
Date: Tue, 31 Aug 2010

Would it be possible to have a .htaccess file in webroot/, that requires
user test001 for dir webroot/test001, user gghh for dir webroot/gghh,
etc. as a valid user dynamically?

In other words it would require the user with the same name as the
dirname. This can ofcourse be achieved with a large config but I want to
use wild cards so that whenever I create a directory in webroot and add
a user to the .htpasswd file, it will be required automatically for
simple access login.

I read the Apache docs but i can't get it to work...