LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Need help with file permissions (C++ and PHP) (https://www.linuxquestions.org/questions/programming-9/need-help-with-file-permissions-c-and-php-860111/)

fcdev 02-01-2011 07:55 PM

Need help with file permissions (C++ and PHP)
 
I've been bashing my head against a wall for a few days now trying to find an elegant solution to this problem.

I have a program written in C++ which generates files using a large amount of resources (making this step unsuitable for PHP). This program is run under a user called "Steve".

Next, I have a web site driven by PHP scripts which allows people to look at previews of the generated files, and match them up with database entries.

Here's where the problem is ...
Once a match is made (within the PHP script), I need to move those files into another folder, where the folder name matches the entry in the database. However, PHP does not have permission to write to the files created by the "Steve" account. (I can't rename, move, or delete them).

I have tried telling the C++ program to create files with permission 0777, but they keep being created with 0755. Same with the directories that PHP creates, they have permission 0755.
I have tried using umask(0777) but that created files with permissions that looked like 0000 (I needed to use the root account to fix them).

Is there an elegant solution to this problem? I specifically don't want to be manually going into the terminal as root user and changing permissions, as these programs are going to be run around 100 times a day.

I'm pretty certain this is something stupid I've overlooked.

MTK358 02-01-2011 08:11 PM

Maybe make a group that contains Steve and the user running the PHP scripts?


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