LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 06-15-2011, 03:01 PM   #1
amangb
LQ Newbie
 
Registered: Jun 2011
Posts: 2

Rep: Reputation: Disabled
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
 
Old 06-15-2011, 05:02 PM   #2
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
Hi,

You need to add:
Code:
IndexOptions ShowForbidden
in the .htaccess of the /var/www/html directory

Regards
 
Old 06-16-2011, 01:33 PM   #3
amangb
LQ Newbie
 
Registered: Jun 2011
Posts: 2

Original Poster
Rep: Reputation: Disabled
[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
 
Old 06-16-2011, 01:53 PM   #4
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
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
 
Old 07-23-2014, 01:35 AM   #5
feipoa
LQ Newbie
 
Registered: Jul 2014
Posts: 2

Rep: Reputation: Disabled
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.
 
Old 07-23-2014, 02:19 AM   #6
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
@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
 
Old 07-23-2014, 04:20 AM   #7
feipoa
LQ Newbie
 
Registered: Jul 2014
Posts: 2

Rep: Reputation: Disabled
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.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
.htaccess vrs <Directory> vous Linux - Software 4 01-06-2007 01:04 PM
.htaccess restricting parent directory Braytac Linux - Networking 2 05-26-2005 05:27 PM
Directory with .htaccess is invisible?! Barca Linux - General 5 02-23-2005 12:28 PM
apache .htaccess and htpasswd - can't lock directory jordanthompson Linux - Software 9 02-07-2005 11:12 PM
Directory listing control with .htaccess quincy56 Linux - Security 0 02-09-2002 10:50 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

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

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration