LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian
User Name
Password
Debian This forum is for the discussion of Debian Linux.

Notices


Reply
  Search this Thread
Old 12-07-2009, 01:05 PM   #1
cccc
Senior Member
 
Registered: Sep 2003
Distribution: Debian Squeeze / Wheezy
Posts: 1,623

Rep: Reputation: 51
Protect cgi-bin directory using .htaccess


hi

Howto protect a cgi-bin sub-directory using .htaccess on Etch with Apache 2.2.3-4?
I've tried in .htaccess:
Code:
AuthUserFile /var/pw/.htpasswd

  AuthGroupFile /dev/null
  AuthName "Password Required"
  AuthType Basic

  require user mysecretuser
but I'm getting Internal Server Error.
 
Old 12-07-2009, 01:24 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 also edit httpd.conf and use something like:
Code:
<Directory "/path/to/apache/cgi-bin">
deny from all
AllowOverride AuthConfig
Order allow,deny
</Directory>
 
Old 12-07-2009, 02:26 PM   #3
cccc
Senior Member
 
Registered: Sep 2003
Distribution: Debian Squeeze / Wheezy
Posts: 1,623

Original Poster
Rep: Reputation: 51
Quote:
Originally Posted by bathory View Post
Hi,

You need to also edit httpd.conf and use something like:
Code:
<Directory "/path/to/apache/cgi-bin">
deny from all
AllowOverride AuthConfig
Order allow,deny
</Directory>
I changed how you suggested, but now I'm getting the following message:

Forbidden
You don't have permission to access /cgi-bin/formmail/fpm.cgi on this server.
 
Old 12-07-2009, 04:36 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
Were you prompted to give username/password?
Can apache user read the password file (/var/pw/.htpasswd)?
What do the logs say?
 
Old 12-07-2009, 06:16 PM   #5
cccc
Senior Member
 
Registered: Sep 2003
Distribution: Debian Squeeze / Wheezy
Posts: 1,623

Original Poster
Rep: Reputation: 51
THX, I've created .htpasswd again using:

# htpasswd -c /var/pw/.htpasswd mysecretuser

restarted the server and now it seems to work.
 
  


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
How to list the contents of Apache's cgi-bin directory? Joel Koltner Linux - Newbie 4 03-27-2009 11:23 PM
Is it possible to serve .htm files from cgi-bin directory? zoonalex Linux - Server 1 12-02-2008 03:53 PM
Cannot access cgi-bin directory for Nagios hywaydave23 Linux - Software 1 10-12-2005 06:16 AM
.htaccess and cgi-bin (apache of course) finegan Linux - Software 4 05-01-2003 04:21 PM
Question on virtual hosts and CGI-BIN directory cgchris99 Linux - General 9 10-11-2002 11:57 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian

All times are GMT -5. The time now is 12:33 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