2

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 get a 500 error and Apache log says:

configuration error: couldn't check user. No user file?: /

MrWhite
  • 11,643
  • 4
  • 25
  • 40
bacord
  • 21
  • 1
  • 4

1 Answers1

5

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.

larsks
  • 41,276
  • 13
  • 117
  • 170
  • That allowed for for some progress.. I have edited my post to include the new apache error – bacord Jan 06 '11 at 15:29
  • 1
    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 06 '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 06 '11 at 15:38
  • 1
    Right, it shouldn't be a path to a directory. It should be a path to a file. – larsks Jan 06 '11 at 16:27
  • You should also make sure that the webserver has read permissions on the AuthUserFile. Just a thought :) – TrueDuality Jan 06 '11 at 16:31