Solved

Denying access to cgi-bin dir through Apache

Posted on 2000-05-06
5
164 Views
Last Modified: 2013-11-18
Hey all.

Say I have a directory called cgi, which houses scripts called by .shtml pages.  Of course, those scripts are run by the Apache server itself.

For security reasons, I do not want any user to be able to go to www.mywebsite.com/cgi and see all my scripts.

If I password protect the directory, then the server cannot execute any of my SSId CGI files in that directory.

How can I prevent users from going to that directory, while at the same time getting my server to execute those server-side-includes?  

I'd like a better answer than "just put an index.html file in that directory," as I'm sure that isn't the most secure thing to do.
0
Comment
Question by:htrosxlmn
  • 3
  • 2
5 Comments
 
LVL 40

Expert Comment

by:jlevie
ID: 2785723
As far as the web server is concerned, just don't include an "indexes" directive for the cgi-bin directory.
0
 

Author Comment

by:htrosxlmn
ID: 2785839
How do I do that?  I am not the admin, but the admin will do whatever I ask him to.  

Walk me through it and you got the points. ;)
0
 
LVL 40

Accepted Solution

by:
jlevie earned 150 total points
ID: 2786232
I'll try to, but whether I can or not depends on what web server is in use. If it is Apache, or another that uses a similar type of config file you'd want to change the definition of the cgi-bin directory from:

<Directory "/opt/Apache/cgi-bin">
   AllowOverride None
   Options Indexes ExecCGI
   Order allow,deny
   Allow from all
</Directory>
 
to:

<Directory "/opt/Apache/cgi-bin">
   AllowOverride None
   Options ExecCGI
   Order allow,deny
   Allow from all
</Directory>
0
 

Author Comment

by:htrosxlmn
ID: 2789428
Someone outside of this site suggested I put an .htaccess file in that directory that said

Options -Indexes

That's it!  That did the trick.  I'm giving you the points anyway, but I wanted you to know how I did it.
0
 
LVL 40

Expert Comment

by:jlevie
ID: 2789968
Yeah, that would work also. Generally you'd like to be able to do it at the server level as those files are typically owned by root and ordinary users can't get in & change the settings.
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

I will show you how to create a ASP.NET Captcha control without using any HTTP HANDELRS or what so ever. you can easily plug it into your web pages. For Example a = 2 + 3 (where 2 and 3 are 2 random numbers) Session("Answer") = 5 then we…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now