Solved

running apache under its own user account

Posted on 2006-10-28
3
274 Views
Last Modified: 2013-12-16
I have a dedicated server I want to configure to get around this problem:

Only files owned by Apache are accessible to PHP scripts, this is often impractical when many developers are working on the same project, or when you want PHP to read a file without changing its ownership.   And visa-versa: files created by Apache are not accessible by my user account when I ftp.

I had a linux admin set up the server but he's gone awol on me.

Here's what's been done so far:

Created an Apache group:

   When I ftp in and create a directory, its ownership is:

      Owner awarner
      Group Apache
      perms: 755

  When I upload a file:

      Owner awarner
      Group Apache
      perms: 644    

In php.ini

   safe_mode = Off
   safe_mode_gid = On

(With safe_mode_gid enabled instead of safe_mode, PHP will be able to open files that belong to Apache's group regardless of the owner, so if there are several developers working on the same server, add them to Apache's group, make it their default group, and everything should be set.)


Apache runs as nobody, nobody. Do I add nobody to the Apache group, or do I change the user account apache runs under to Apache (and how)

According WebMin, both user Apache and nobody belong to these secondary groups. Why so many? Is this right?

root
bin
daemon
sys
adm
tty
disk
lp
mem
kmem
wheel
mail
news
uucp
man
games
gopher
dip
ftp
lock
nobody
users
dbus
floppy
vcsa
rpm
utmp
haldaemon
slocate
pcap
named
netdump
sshd
rpc
mailnull
smmsp
apache
squid
webalizer
xfs
ntp
dovecot
screen
cw          <-- another user
mysql
awarner   <-- me

0
Comment
Question by:drew22
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 10

Expert Comment

by:ssvl
ID: 17825500
1. if you run via http yes php is only access apache owned or permited files
0
 
LVL 1

Author Comment

by:drew22
ID: 17825817
Apache runs as nobody, nobody. Do I add nobody to the Apache group, or do I change the user account apache runs under to Apache (and how)
0
 
LVL 10

Accepted Solution

by:
ssvl earned 500 total points
ID: 17826207
change the configration file to

user apache
group apache
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you have a server on collocation with the super-fast CPU, that doesn't mean that you get it running at full power. Here is a preamble. When doing inventory of Linux servers, that I'm administering, I've found that some of them are running on l…
In the first part of this tutorial we will cover the prerequisites for installing SQL Server vNext on Linux.
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
Suggested Courses

623 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