exec() function - which user on linux

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
bluesman333
Forum Commoner
Posts: 52
Joined: Wed Dec 31, 2003 9:47 am

exec() function - which user on linux

Post by bluesman333 »

which user, if on linux system, executes a command when using the exec() function?

i'm assuming it's the user assigned to apache.

if so. is it possible to run root commands with exec()?
m3rajk
DevNet Resident
Posts: 1191
Joined: Mon Jun 02, 2003 3:37 pm

Post by m3rajk »

it runs as whatever the user is that does the apache/php daemon.... normally nobody


i would assume you can always have exec run a series of commands.....

exec('su \n<pass>....');

or something like that, but i'm not sure
timvw
DevNet Master
Posts: 4897
Joined: Mon Jan 19, 2004 11:11 pm
Location: Leuven, Belgium

Post by timvw »

you never want to run commands as root.. (or run apache as root)

options are:
- setup suEXEC for apache
- setup some ACL and allow the webserver user to perform whatever task
- play with the suid and sgid bits...
Post Reply