0

I'm trying to protect a directory using .htaccess and .htpasswd.

I created the file .htpasswd in /home/marcos and looks such that:

profesor:weuqwhdiuqh

In the directory I want to protect (/var/www/privado) I have a .htaccess file with the following contents.

AuthUserFile /home/marcos/.htpasswd
AuthName Testing
AuthType Basic
require user profesor

If I access http://localhost/privado/privado.html it should see the prompt to enter login data. Instead, the prompt does not appear and the page is displayed normally.

What am I doing wrong?.

I am using apache2 on Ubuntu 11.04 server.

These are the modules loaded (viewd on phpinfo)

core mod_log_config mod_logio prefork http_core mod_so mod_alias mod_auth_basic mod_authn_file mod_authz_default mod_authz_groupfile mod_authz_host mod_authz_user mod_autoindex mod_cgi mod_deflate mod_dir mod_env mod_mime mod_negotiation mod_php5 mod_reqtimeout mod_setenvif mod_status

Thanks for the help.

Regards!

Lobo
  • 4,001
  • 8
  • 37
  • 67
  • 3
    Do you have any `Deny`/`Allow` statements in the .htaccess? Do you have a `satisfy any` or `satisfy all` directive in the .htaccess? Are you sure your `.htaccess` file is read by Apache (try placing some garbage on a line there and see if you'll get an `500 Internal Server Error` if you access the private directory)? – lanzz Jun 04 '12 at 21:26
  • Make sure that handling of .htaccess files is enabled (and not restricted, i.e. suitable AllowOverride directives must be set) in the Apache configuration. See Apache's documentation for details. – Jan Krüger Jun 04 '12 at 21:27
  • 1
    From the troubleshooting part of the documentation: "Make sure the permissions on the .htaccess and .htpasswd files are set so that Apache can read them. `chmod 0644 .htaccess` and `chmod 0644 .htpasswd`". – Styxxy Jun 04 '12 at 21:27
  • @lanzz I try to placing some garbage on a line to produce a 500 Internal Server Error but the error did not appear. – Lobo Jun 05 '12 at 19:31
  • @Styxxy I set 0644 permissions to both files and nothing changes – Lobo Jun 05 '12 at 19:46
  • @JanKrüger if I put the AllowOverride AuthConfig in the apache2.conf file and restart the apache console shows me the following message: Allowoverride not allowed here – Lobo Jun 05 '12 at 19:47

0 Answers0