Jump to content

[SOLVED] Apache and AuthConfig


free_bsd

Recommended Posts

Hello all,

 

I have made a directory for authentication (htpasswd)

 

When i put it in a .htaccess file and browse to the content i see the directory secret as a directory on my webpage. (i dont have a index.html so i see directory's

And when i put it in httpd.conf as a <Directory> and browse to my webpage the directory isnt visible, only by typing it for example http://my.domain.com/~user/secret

 

Hope someone can tell me if this is normal ? (if you understand my bad english :)

 

Thanks, Free_BSD

 

Link to comment
https://forums.phpfreaks.com/topic/65017-solved-apache-and-authconfig/
Share on other sites

If the files (secret) are named as follows:

 

.htpasswd  = place where the password/secret should be stored

.htaccess    = place to tell apache where the .htpasswd is kept etc.

 

then by default apache will not allow anyone to access them.

 

-steve

Ah thanks,

 

So if i don't use .htaccess and instead put it in my httpd.conf as :

 

<Directory /home/*/public_html/secret>

    AllowOverride AuthConfig

    AuthType Basic

    AuthName "secret"

    AuthUserFile /usr/local/www/apache22/passwd/passwords

    Require user test

</Directory>

 

Then such a directory will never be visible ? and only can be accessed if you know the name of the directory ? to put in your username and password.

 

and with .htaccess a directory is visible ?

 

Sorry for the noobynish but i read that the use of <Directory></Directory> is saver then .htaccess

Ok - Putting the Auth details in <Directory></Directory> is better practice.

 

BUT - you should still keep passwords in a file named ".htpasswd". NOT in a file called passwords. So it should be the following:

AuthUserFile /usr/local/www/apache22/passwd/.htpasswd

 

Anyways, as you asked:

No, the <Directory /home/*/public_html/secret> will not be visible to those without the password.

Yes - The person WILL have to know the name of the directory

Yes - The user test will have to enter the correct password.

 

-steve

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.