LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   htaccess (https://www.linuxquestions.org/questions/linux-newbie-8/htaccess-393402/)

kuplo 12-15-2005 10:38 PM

htaccess
 
What do I have to put in an .htaccess file and .htpasswd file so that it asks me for my username and password to access a directory?

I know it's got to be something simple, but the more I looked at apache.org the more I got turned around clicking on different links for directives and what not.

Can someone tell me what it is I have to do to make that work. And if in my .conf file for the virtual host I have
Code:

<Directory "/srv/blah blah blah - path to the virtual hosts root directory>
Options None
Allowoverride None
Order allow,deny
Allow from all
</Directory>

Will it negate any htaccess file because of the Allowoverride None in the yast.conf file that holds my virtual hosts?

Thank you for your help, I want to password protect the clients log and webalizer files as well as be able to put it in my faqs for future clients.

Much appreciated.

bathory 12-16-2005 02:12 AM

First you have to change Allowoverride to AuthConfig
Then create a .htaccess file in the directory you want to protect, with something lke this:
Code:

AuthName      "Protected Area"
AuthType        Basic
AuthUserFile  /path/to/htpasswd
require user    username

And use htpasswd to create a password for the user "username"

kuplo 12-16-2005 02:39 AM

So you have to create a new <directory> </directory> file for every folder I want to password protect for each virtual host that wants to password protect one or more of their directories. Man, this is really turning out to be some work lately.

bathory 12-16-2005 04:33 AM

You can do this, or you can change the Allowoveride for the whole DocumentRoot which then makes apache a little slower because for every request to different directories it has to search if there is a .htaccess file

kuplo 12-16-2005 05:42 AM

I dont think my servers apache was configured with this ability because when I replaced Allowoverride None with AuthConfig then restarted apache and it said that line was no good. Im gonna start looking for a specialist in my area that makes home/office calls, and get him to install the mail server proerly so that clients can get their email, right now they can send out, but not receive anything, and take care of the little things like this I'll watch over him like a hawk with notebook in hand taking full notes of what he's doing in case I have to do it again. Im getting it (the information from books and forums, but things are moving way too slow), I need a fully running server with webmin or some inexpensive control panel lastweek so I can start hitting up th esmall business's in my area and get their business.

Thanks for the try,

P.S. It's SuSE 9.3 PRO.


All times are GMT -5. The time now is 03:33 PM.