I just edited the htaccess file to include:

AuthType Basic

AuthName "My Protected Area"

AuthUserFile /home/path/to/public_html/

Require valid-user

I then created a htpasswd file via the htpasswd command. I have enabled the module: LoadModule authn_file_module modules/mod_authn_file.so in the Apache configuration.

Now, when I load the page I now get a 500 error and apache log says "configuration error: couldn't check user. No user file?: /"

link|improve this question
What does your error_log say? – Niall Donegan Jan 6 '11 at 15:06
/path/to/public_html/.htaccess: Invalid command 'AuthUserFile', perhaps misspelled or defined by a module not included in the server configuration – bacord Jan 6 '11 at 15:17
feedback

1 Answer

The AuthUserFile command is provided by the mod_authn_file module. Make sure your Apache configuration includes something along the lines of:

LoadModule authn_file_module modules/mod_authn_file.so

This would need to go into the main server configuration, not in a .htaccess file. If you don't have access to the main server configuration you'll need to contact your local administrator.

link|improve this answer
That allowed for for some progress.. I have edited my post to include the new apache error – bacord Jan 6 '11 at 15:29
If you're config really has AuthUserFile /home/path/to/public_html/ you've got a problem, because that's not a path to a file. The AuthUserFile directive specifies the path to an htpasswd-style file containing usernames and passwords. – larsks Jan 6 '11 at 15:34
No I have included the actual path to my directory I just didn't include it in the post – bacord Jan 6 '11 at 15:38
Right, it shouldn't be a path to a directory. It should be a path to a file. – larsks Jan 6 '11 at 16:27
You should also make sure that the webserver has read permissions on the AuthUserFile. Just a thought :) – TrueDuality Jan 6 '11 at 16:31
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.