The following is a typical piece of httpd.conf to create a password-protected directory:
ScriptAlias /authcgi/ "/var/www/auth_cgi/"
<Directory "/var/www/auth_cgi/">
AllowOverride None
Options None
AuthUserFile "/var/www/web_passwd"
AuthType Basic
AuthName "TinyMail Users"
require valid-user
</Directory>
For this to work Apache needs read access to the password file (basically a copy of /etc/shadow). But users don't.
There are clearly security issues here. Remote users must have no way to create a script capable of accessing the password file, and should probably not have shell access. The root password should not be included in the webserver-accessible copy