Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to set Apache Basic Authentication to lock a directory, except for one file?

I'm working on an upcoming project, but the team needs to access it online. I've setup (for now) Basic Authentication using:

    <Directory /var/www/html>
            AuthType Basic
            AuthName "Staging"
            AuthUserFile /etc/passwd
            Require valid-user
    </Directory>

But, I need one file to be publically accessible (a 3rd party service needs to ping it, but can't handle Basic Authentication. Is it possible to "turn off" authentication for a specific file ("specific-file.php")?

I was looking into:

    <Files "/var/www/html/specific-file.php">
            ### SOMETHING
    </Files>

but it is not clear to me how to disable the protection.

Thanks!

like image 211
Michael T. Smith Avatar asked Jul 01 '10 20:07

Michael T. Smith


People also ask

How do I password protect Apache with Basic Authentication?

The htpasswd command will allow us to create a password file that Apache can use to authenticate users. We will create a hidden file for this purpose called . htpasswd within our /etc/apache2 configuration directory. The first time we use this utility, we need to add the -c option to create the specified passwdfile.

What is an important thing to keep in mind if using the Basic Authentication type in Apache?

It is important to be aware, however, that Basic authentication sends the password from the client to the server unencrypted. This method should therefore not be used for highly sensitive data, unless accompanied by mod_ssl . Apache supports one other authentication method: AuthType Digest .

How many types of HTTP authentication are used in the Apache server?

Introduction. HttpClient supports three different types of http authentication schemes: Basic, Digest and NTLM. These can be used to authenticate with http servers or proxies.

Is Apache authentication secure?

Apache supports one other authentication method: AuthType Digest . This method is implemented by mod_auth_digest and is much more secure. Most recent browsers support Digest authentication. The AuthName directive sets the Realm to be used in the authentication.


1 Answers

This works for me:

Allow from all
Satisfy any
like image 170
adk Avatar answered Oct 06 '22 00:10

adk