LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
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-14-2011, 09:43 AM   #1
SkyerSK
Member
 
Registered: Oct 2010
Location: Europe
Distribution: Gentoo
Posts: 206

Rep: Reputation: 10
Apache2 disabling access do directories/files


Hello,
I've got kind of "noobie" question for you, but I can't find answer any way. I have got Apache2 and PHP5 installed, and I need to restrict access to directories, for example, to /etc.

Apache2 DocumentRoot works good for mapping URLs, but I can't get rid of Php being able to include /etc/passwd and stuff like that using "../../../" trick. (I made a file which includes it).

I was wondering about chrooting Apache, but I think it may break configuration of server.

So my question: Is there a way to disable access for Php and some other scripts to some directories?

Thanks for any replies.
 
Old 01-14-2011, 10:38 AM   #2
Touch
LQ Newbie
 
Registered: Oct 2009
Distribution: RHEL & Fedora
Posts: 25

Rep: Reputation: 0
Are you running apache as root? If so use another account that won't have access to those files.
 
Old 01-14-2011, 12:19 PM   #3
SkyerSK
Member
 
Registered: Oct 2010
Location: Europe
Distribution: Gentoo
Posts: 206

Original Poster
Rep: Reputation: 10
Thanks for your answer. No, (well, there are several instances to raise performance, but only one runs as root actually) but for example /etc/passwd has default "rwxr--r--" rights, and chmod-ing all these files would be really painful for me. Also, doing this recursively to all files should not work for me either, as far as I know not all files should have same rights.
 
Old 01-15-2011, 03:40 AM   #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,

Have a look at open-basedir.

Regards
 
1 members found this post helpful.
Old 01-15-2011, 04:35 AM   #5
SkyerSK
Member
 
Registered: Oct 2010
Location: Europe
Distribution: Gentoo
Posts: 206

Original Poster
Rep: Reputation: 10
Thanks much, exactly what I was looking for. (First I was little upset because safe_mod had to be on for files like /etc/passwd, and it didn't restrict access to all files. Also doc_root kindly didn't work for me...).
 
  


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
Disabling apache2 from boot brgsousa Linux - Software 5 05-21-2010 07:43 AM
Group write access for newly created files/directories without changing umask fhd Linux - Security 3 04-05-2009 05:28 AM
Apache2, Slack 12.2 and CGI Directories.....? arfon Slackware 2 03-18-2009 09:45 AM
ftp : access denied to some files / directories as root XavierX Linux - Software 2 07-18-2006 06:01 AM
Havin trouble allowing FTP users to access files and directories bripage Linux - Networking 9 04-15-2002 03:54 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 11:43 PM.

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