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
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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.