LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
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 07-02-2008, 10:28 PM   #1
dtra
Member
 
Registered: Nov 2004
Distribution: fc4
Posts: 104

Rep: Reputation: 15
make apache run as the user


hi all

i'm trying to set up my home server in a way that is similar to dreamhost
i've got the site running correctly from my home directory, but apache just isn't allowed to perform certain actions (mostly file i/o) because it doesn't have the correct permissions

i am using fedora 8 with the yum installed httpd
php (5.2.6) is compiled from source and works fine (as a cgi app)

i've tried to tweak suexec a couple of times, but i really don't know how it works, or if it is even the right thing to play with

so my question is, how do i make apache run as the logged in user (or the user that owns the directory) rather than as itself?

any ideas?
dave
 
Old 07-02-2008, 11:33 PM   #2
Mr. C.
Senior Member
 
Registered: Jun 2008
Posts: 2,529

Rep: Reputation: 59
Give read and directory execute permissions to your web files. You're offering them to the world - read permission won't hurt anything locally.

Apache runs privileged because it opens a privileged port (TCP port 80). What real problem are you trying to solve ?
 
Old 07-02-2008, 11:45 PM   #3
dtra
Member
 
Registered: Nov 2004
Distribution: fc4
Posts: 104

Original Poster
Rep: Reputation: 15
thanks for your reply

read is not the problem, i can view the site fine
the problem is writing files, because the site is located in a user home directory
apache doesn't have permissions to write any files there when it is run by the www user (or nobody or whatever it is)
i need it to be run by the actual owner of the home directory, ie. the php.cgi needs to be executed by the home owner and not by apache

does that make sense?

dave
 
Old 07-03-2008, 12:00 AM   #4
Mr. C.
Senior Member
 
Registered: Jun 2008
Posts: 2,529

Rep: Reputation: 59
Apache can of course write and create files provided the directory permissions are set appropriatly. You can make them group owned by www and give whatever permission you want to owner/other.

If you need the cgi to run as a user, then either use suexec, or a setuid program that performs the operations. There are security considerations in either case, and there is no short, easy way to describe them. You're going to have to learn about setuid regardless, but start with http://httpd.apache.org/docs/2.2/suexec.html.
 
  


Reply

Tags
apache, cgi, php


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
How to make ppp scripts run as user Grunty Slackware 6 09-13-2005 08:54 PM
Cannot run 'make menuconfig' as user CowboyJ Linux - Newbie 1 09-17-2004 11:00 PM
how do I make sure that the user that is going to run the script is a root user??? nikold01 Linux - General 3 09-10-2004 07:54 AM
How to make Apache run umannu Linux - Software 5 12-07-2003 04:50 PM
user under which apache tomcat run?? Sridhar Guntur Linux - Security 2 08-28-2003 01:06 PM


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