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
bluesman333
Forum Commoner
Posts: 52 Joined: Wed Dec 31, 2003 9:47 am
Post
by bluesman333 » Tue Dec 28, 2004 7:06 pm
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 » Tue Dec 28, 2004 7:36 pm
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 » Tue Dec 28, 2004 9:40 pm
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...