Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 285
  • Last Modified:

running apache under its own user account

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
drew22
Asked:
drew22
  • 2
1 Solution
 
ssvlCommented:
1. if you run via http yes php is only access apache owned or permited files
0
 
drew22Author Commented:
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
 
ssvlCommented:
change the configration file to

user apache
group apache
0

Featured Post

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now