I thought of suPHP but that's not what I need. It doesn't serve to my purposes to run the whole PHP script as a different user. I just need to run one single linux command line as a different user.
Is it possible?
I thought of suPHP but that's not what I need. It doesn't serve to my purposes to run the whole PHP script as a different user. I just need to run one single linux command line as a different user.
Is it possible?
I believe you should try another approach. The "setuid".
http://en.wikipedia.org/wiki/Setuid
Basically you ask the file to run as it's owner, not the program.
You could try the shell_exec function and sudo
edit: seeing as sudo prompts for a password, you'd might wanna use proc_open, which allows you to use pipes. See this comment for how to create a custom password pipe.
You can use that users CRON to execute the script. If this is a web application then you are limited to the Apache/Nobody user with limited permissions. If this just needs to run at a certain time I would use CRON.
Another approach is Sticky Bits