Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I need to restrict certain user from a BasicAuth configured system to come only from certain IP address but allow the rest to come from anywere.

I know that I can restrict access using Deny and Allow directives and know also how to restrict access to users using Require. But I need a mix of both and I don't have a clue.

share|improve this question
add comment

1 Answer

up vote 3 down vote accepted

You need to use the Satisfy directive. I believe it would look something like this:

AuthUserFile /path/to/File
AuthName "Go away"
AuthType Basic
Require valid-user

Satisfy any
Order allow,deny
Deny from all
Allow from 192.168.1.1

This will block everyone except 192.168.1.1 unless they enter a password.

If you only want to make the one IP enter the password and allow everyone else with no restrictions then it would be:

Satisfy any
Order allow,deny
Deny from 192.168.1.1
Allow from all
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.