LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   About .htaccess & .htpasswd (https://www.linuxquestions.org/questions/linux-newbie-8/about-htaccess-and-htpasswd-101507/)

edhan 10-08-2003 12:55 AM

About .htaccess & .htpasswd
 
Hi

I have created the .htaccess and .htpasswd in the path /usr/local/apache/cgi-bin/secure

I have checked both .htaccess and .htpasswd are located in the path but when I tried to access the secure directory by using the password I have created for .htpasswd, it does not accept it.

I have created the .htpasswd in plain text so to see that I have key in the correct password and still it does not allow me to access.

Here is what I did. For the httpd.conf:

Directory "/usr/local/apache/cgi-bin/secure">
deny from all
Options ExecCGI
AllowOverride AuthConfig
Order deny,allow
</Directory>

-------------

For .htaccess and chown root .htaccess & chmod 644 .htaccess

AuthType Basic
AuthUserFile /usr/local/apache/cgi-bin/secure/.htpasswd
AuthName Secure
require valid-user
satisfy any

--------------

For .htpasswd and chmod 644 .htpasswd

htpasswd -bcp /usr/local/apache/cgi-bin/secure/.htpasswd admin secure

--------------
Restarted my apache with the command:

apachectl stop

apachectl start

After that, I tried to access the directory:
http://www.yourdomain.com/cgi-bin/secure/

and when it asks for User Name and password, I have keyed in:

User name: admin
Password: secure

after 3 attempts, it says Authorization Required without allowing me to login.

Any idea where I have gone wrong ?

Thanks!

Regards
Edward Han

td_miles 10-08-2003 01:28 AM

I think you need to put:

Order deny,allow

in your .htaccess file as well. A copy of an .htaccess file that I know is working on my machine is:

=========================
AuthUserFile /var/www/passwd
AuthName "Router Statistics"
AuthType Basic
<Limit GET POST>
order deny,allow
deny from all
require user cfg
satisfy any
</Limit>
=========================

edhan 10-08-2003 05:14 AM

Hi miles

Following your example, it gives internal server error.

What else can I do ???

Regards
Edward Han

Drogo 10-17-2003 12:16 AM

Try this :D


AuthUserFile /secure/.htpasswd
AuthName "Private Area"
AuthType Basic

<Limit GET POST>
require valid-user
</Limit>


All times are GMT -5. The time now is 02:24 AM.