LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   Apache require authentication according to client's ip (https://www.linuxquestions.org/questions/linux-server-73/apache-require-authentication-according-to-clients-ip-520347/)

Radicalm16 01-17-2007 09:36 PM

Apache require authentication according to client's ip
 
I've got an apache web server receiving connections from the internet and from the lan.

I've been limiting access (basic authentication) to certain folders using .htaccess files.

Now I've to ask the users comming from the internet to authenticate theirselves and let local users pass through without authentication. Can somebody tell me how can I set it using directives on .htaccess files?

Something like deciding if I require a connection to give a user : password pair based on it's ip address.

I know I could achieve this using two different virtual host directives. But, is there any other way?

Thanks.

osdeals 01-18-2007 10:07 PM

I have a similar setup. Select hosts are permitted access without login / pass, while all others need to authenticate. My .htaccess file reads as:
Code:

order Allow,Deny
Allow from 127.0.0.1
Allow from 1.2.3.4
Allow from 5.6.7.8
AuthType Basic
AuthUserFile /home/user/.htpasswd
AuthGroupFile /dev/null
AuthName "Protected Site"
require valid-user
Satisfy any


Radicalm16 01-19-2007 08:55 AM

Thanks.

The Satisfy Any directive did the trick.


All times are GMT -5. The time now is 04:29 AM.