LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   unhide directory with .htaccess file (https://www.linuxquestions.org/questions/linux-server-73/unhide-directory-with-htaccess-file-886579/)

amangb 06-15-2011 03:01 PM

unhide directory with .htaccess file
 
I am using Apache with Kerberos security enabled. The http page simply lists the directories contained in /var/www/html. I want to make only one of the directories in the document root secured so that when someone clicks on it, it requires him/her to enter credentials. Right now when I place the .htaccess file in the directory I want to protect, the directory is hidden from the list and the user has to enter the whole path to get authenticated and access the files.

I've tried Options +Indexes which was posted all over the net, but it didn't work.

Any help would be highly appreciated.

Aman

bathory 06-15-2011 05:02 PM

Hi,

You need to add:
Code:

IndexOptions ShowForbidden
in the .htaccess of the /var/www/html directory

Regards

amangb 06-16-2011 01:33 PM

[QUOTE=bathory;4386955]Hi,

You need to add:
Code:

IndexOptions ShowForbidden
in the .htaccess of the /var/www/html directory

Thanks bathory, worked perfectly!!

Do you have any idea how to apply directory restrictions based on AD groups rather than users? Right now it works for users, here is my .htaccess file:
Code:

AuthName "Windows Account Login"
AuthType Kerberos
Krb5Keytab /etc/httpd/krb5.keytab
KrbAuthRealm DOMAIN.COM
KrbMethodNegotiate off
KrbSaveCredentials off
KrbVerifyKDC off
require valid-user
#require group DOMAIN.COM\somegroup


bathory 06-16-2011 01:53 PM

Hi,

You can use mod_authnz_ldap to authenticate users through a Windows AD. I'm not familiar with windows stuff to help you further, but if you do a little search, you'll find a lot of documentation about this.

Regards

feipoa 07-23-2014 01:35 AM

I am using the Windows version of Apache 2.0.63. There are certain directories I'd like to be password protected, so I added an .htaccess file to these directories with the following information,

AuthName "Select Viewers"
AuthType Basic
AuthUserFile "C:/Program Files/Apache Group/Apache2/pass/.htpasswd"
Require valid-user

,however once I do this, the directory becomes hidden. The only way to access it via the internet is to already know the directory name. I would like to unhide this directory, but maintain password protected access.

In the Windows version of Apache, I do not see a folder named /var/www/html.

I tried adding IndexOptions ShowForbidden to the .htaccess file, but browser access still did not display the password-protected directories.

I tried adding IndexOptions ShowForbidden to the httpd.conf file under this section,
<Directory "E:/">
Order allow,deny
Allow from all
Options +Indexes
IndexOptions FancyIndexing NameWidth=64
AllowOverride authconfig
</Directory>

however, after saving the httpd.conf file, the Apache service will not start and yields error, "The requested operation has failed!"

I suspect that the IndexOptions ShowForbidden may apply to newer versions of Apache, perhaps version 2.2. What is the analogous equivalent to this command for Apache 2.0.63 when run in Windows? Is there any other way to unhide password protected directories with Apache 2.0.63 in Windows?

Thank you.

bathory 07-23-2014 02:19 AM

@feipoa
Quote:

I suspect that the IndexOptions ShowForbidden may apply to newer versions of Apache, perhaps version 2.2. What is the analogous equivalent to this command for Apache 2.0.63 when run in Windows? Is there any other way to unhide password protected directories with Apache 2.0.63 in Windows?
I'm afraid you're right. "ShowForbidden" is introduced in apache-2.2 and AFAIK there is no equivalent option for apache-2.0.63
Since apache-2.0.x is no longer maintained, it's better to upgrade

PS: And please don't hijack others threads, you should start your own

Regards

feipoa 07-23-2014 04:20 AM

My appologies. I did not feel I was "hijacking" this thread - my question is consistent with the OP. There exists some variability in what users refer to as "hijacking", so I appologise if my interpretation and consequent action upsets you.

Unfortunately, Apache 2.0.63 was the latest version of Apache I was able to get functioning with Windows NT 4.0 on my 486. It may be there are other methods to display password-protected directories in Apache 2.0.x.


All times are GMT -5. The time now is 08:56 AM.