Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

running apache under its own user account

Posted on 2006-10-28
3
Medium Priority
?
277 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 2000 total points
ID: 17826207
change the configration file to

user apache
group apache
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

SSH (Secure Shell) - Tips and Tricks As you all know SSH(Secure Shell) is a network protocol, which we use to access/transfer files securely between two networked devices. SSH was actually designed as a replacement for insecure protocols that sen…
Linux users are sometimes dumbfounded by the severe lack of documentation on a topic. Sometimes, the documentation is copious, but other times, you end up with some obscure "it varies depending on your distribution" over and over when searching for …
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…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
Suggested Courses

722 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