Solved

running apache under its own user account

Posted on 2006-10-28
3
267 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
  • 2
3 Comments
 
LVL 10

Expert Comment

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

Author Comment

by:drew22
Comment Utility
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
Comment Utility
change the configration file to

user apache
group apache
0

Featured Post

Free Gift Card with Acronis Backup Purchase!

Backup any data in any location: local and remote systems, physical and virtual servers, private and public clouds, Macs and PCs, tablets and mobile devices, & more! For limited time only, buy any Acronis backup products and get a FREE Amazon/Best Buy gift card worth up to $200!

Join & Write a Comment

Little introduction about CP: CP is a command on linux that use to copy files and folder from one location to another location. Example usage of CP as follow: cp /myfoder /pathto/destination/folder/ cp abc.tar.gz /pathto/destination/folder/ab…
Join Greg Farro and Ethan Banks from Packet Pushers (http://packetpushers.net/podcast/podcasts/pq-show-93-smart-network-monitoring-paessler-sponsored/) and Greg Ross from Paessler (https://www.paessler.com/prtg) for a discussion about smart network …
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…

762 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now