PDA

View Full Version : Change the user and group that PHP executes as


Shella
5th March 2009, 19:07
Hi all, i'm hardening a web server with apache.
PhpsecInfo suggest me to do this:

"Change the user and group that PHP executes as. If you're using the Apache module, you'll need to change what user Apache runs as with the User and Group directives"

How can I do it? On my server i got just root user and root group.
I can create new users and new group but how can I tell to system to use that user to execute PHP?
Thanks a lot.

falko
6th March 2009, 14:54
If you're using mod_php, you must change the User and Group directives in the apache configuration.

To create users and groups, take a look at
man groupadd
man useradd

Shella
6th March 2009, 15:55
If you're using mod_php, you must change the User and Group directives in the apache configuration.

To create users and groups, take a look at
man groupadd
man useradd

Thanks Falko, the problem is that i don't know how to change the User and Group directives in the apache configuration. I know how to add users and group but where I can change? apache2.conf? Thanks.

falko
7th March 2009, 16:03
Depends on your distribution. For Debian/Ubuntu, it's /etc/apache2/apache2.conf, and for Fedora/CentOS, it's /etc/httpd/conf/httpd.conf.