LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   PHP: restrict script to one dir & and to one user (https://www.linuxquestions.org/questions/linux-newbie-8/php-restrict-script-to-one-dir-and-and-to-one-user-783882/)

knockout_artist 01-21-2010 07:07 PM

PHP: restrict script to one dir & and to one user
 
Hi,

1-Can I do su - userA in php? Cam I have php run the whole script as userA.

2-Can I make php to run from a certain directory? like chroot kind of things.


Thanks.

sneakyimp 01-21-2010 09:44 PM

for #2, you may find these functions useful. You can chdir or chroot if you like.

For #1, that's more tricky. The php docs on exec have some suggestions...like this one:
Code:

exec("echo 'apache' | /usr/bin/sudo -u mail -S /var/www/html/mailset.sh $name");


All times are GMT -5. The time now is 05:09 AM.