LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   .htaccess / .htpasswd don't work, what do I miss (https://www.linuxquestions.org/questions/linux-newbie-8/htaccess-htpasswd-dont-work-what-do-i-miss-852553/)

MarkRaats 12-27-2010 02:15 AM

.htaccess / .htpasswd don't work, what do I miss
 
Hi guys

I've installed apache2 / php5-mysql / libapache2-mod-php5 / mysql-server. My question is, which packages must be installed?

in the /var/www/
I've .htpasswd
user:sQjrqRjCfEXJI

I've (also) in the /var/www/
.htaccess

AuthName "Restricted Area"
AuthType Basic
AuthUserFile /var/www/.htpasswd
AuthGroupFile /dev/null
require user user

When I enter (from other pc in the LAN) http://<ip-from-server>/gitweb there is nothing, yeah the website offcourse, but without post user and password. So it's not restrected. What dit I wrong or what do I need to install?

Greetz
Mark

edit: it looks like its because my htaccess, because when I edit the htaccess with:
order allow,deny
deny from <client-ip>
allow from all
I've still access to the folder.

repo 12-27-2010 02:55 AM

Did you set the AllowOverride ?
http://httpd.apache.org/docs/1.3/mod...#allowoverride

Kind regards

MarkRaats 12-28-2010 01:51 AM

no dont use that, but no diffrence.

.passwd
---
test:sQjrqRjCfEXJI

.htaccess
---
<Directory>
AllowOverride all
AuthName "Restricted Area"
AuthType Basic
AuthUserFile /var/www/.htpasswd
AuthGroupFile /dev/null
require user test
</Directory>

repo 12-28-2010 03:36 AM

You need to set this in your
Quote:

/etc/httpd/httpd.conf
file, and restart the daemon.
The default is set to none.

Kind regards

MarkRaats 12-29-2010 01:54 AM

Maybe a stupid question...
what must i set in my httpd.conf ?
first of all, httpd.conf is (here) in /etc/apache2/

now i changed the .htaccess file in:

Code:

AuthName "Restricted Area"
AuthType Basic
AuthUserFile /var/www/.htpasswd
AuthGroupFile /dev/null
require user test

in etc/apache2/httpd.conf
Code:

<Directory /www/gitweb/>
AllowOverride all
</Directory>

Code:

/etc/init.d/apache2 restart


All times are GMT -5. The time now is 06:00 PM.