LinuxQuestions.org
Visit the LQ Articles and Editorials section
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 01-06-2007, 09:46 AM   #1
vous
Member
 
Registered: Mar 2003
Location: Macondo
Distribution: Mandrake 9.1, 10.1, SuSE 8.1 pro, 10.1, Red Hat 8.0/9.0
Posts: 380

Rep: Reputation: 30
.htaccess vrs <Directory>


In my Apache httpd.conf file I see this by default:

>>>>>>
# forbid access to the entire filesystem by default
<Directory />
Options None
AllowOverride None
Order deny,allow
Deny from all
</Directory>

# use .htaccess files for overriding,
AccessFileName .htaccess
# and never show them
<Files ~ "^\.ht">
Order allow,deny
Deny from all
</Files>

<<<<<<

Which is a great security measure BUT I am not sure what is the best way to override this (for my public html dir), without killing the initial intended functionality of protecting the rest of my file system.

In the Apache docs I see two options:

1) .htaccess

2) Or creating a <Directory> entry in my httpd.conf

I am not sure which one should I take?

Any ideas??!
 
Old 01-06-2007, 11:42 AM   #2
raskin
Senior Member
 
Registered: Sep 2005
Location: Russia
Distribution: NixOS (http://nixos.org)
Posts: 1,893

Rep: Reputation: 68
Second, because first doesn't work with AllowOverrides None.
 
Old 01-06-2007, 01:12 PM   #3
vous
Member
 
Registered: Mar 2003
Location: Macondo
Distribution: Mandrake 9.1, 10.1, SuSE 8.1 pro, 10.1, Red Hat 8.0/9.0
Posts: 380

Original Poster
Rep: Reputation: 30
OK, but how safe it?

Will it override this security entry:

>>>>>>
# forbid access to the entire filesystem by default
<Directory />
Options None
AllowOverride None
Order deny,allow
Deny from all
</Directory>

# use .htaccess files for overriding,
AccessFileName .htaccess
# and never show them
<Files ~ "^\.ht">
Order allow,deny
Deny from all
</Files>

<<<<<<
 
Old 01-06-2007, 01:28 PM   #4
raskin
Senior Member
 
Registered: Sep 2005
Location: Russia
Distribution: NixOS (http://nixos.org)
Posts: 1,893

Rep: Reputation: 68
I do nothing special, and yet I get a 403 while trying to access .htaccess from 127.0.0.1 .

It will override - locally - settings for higher directory. And what do you understand under 'safe'? To have httpd entirely safe you need to shut it down... I guess it doesn't give .ht* files to anyone by default. But it will give HTML pages. It will also give results of running cgi scripts, but - if handlers are properly configured - not scripts themselves.
 
Old 01-06-2007, 02:04 PM   #5
billymayday
Guru
 
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678

Rep: Reputation: 122Reputation: 122
Apache only recommend using htaccess where you can't give access to the config file - for example, an ISP hosting sites will give clients htaccess abilities because you obviously can't let them edit httpd.conf
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
web site directory security? .htaccess or httpd.conf Moonman Linux - Software 0 03-03-2006 09:51 PM
.htaccess restricting parent directory Braytac Linux - Networking 2 05-26-2005 06:27 PM
Directory with .htaccess is invisible?! Barca Linux - General 5 02-23-2005 01:28 PM
apache .htaccess and htpasswd - can't lock directory jordanthompson Linux - Software 9 02-08-2005 12:12 AM
Directory listing control with .htaccess quincy56 Linux - Security 0 02-09-2002 11:50 AM


All times are GMT -5. The time now is 09:08 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration