LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 02-01-2011, 07:55 PM   #1
fcdev
Member
 
Registered: Sep 2005
Posts: 47

Rep: Reputation: 15
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.
 
Old 02-01-2011, 08:11 PM   #2
MTK358
LQ 5k Club
 
Registered: Sep 2009
Posts: 6,443
Blog Entries: 3

Rep: Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723
Maybe make a group that contains Steve and the user running the PHP scripts?
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
MySQL/PHP/Apache application - file permissions rgriffiths Linux - Server 4 05-17-2009 03:20 AM
Permissions for file uploading script in php emab Programming 7 08-31-2008 06:53 AM
permissions on flat file php authentication blizunt7 Linux - Security 2 11-23-2005 06:13 AM
file permissions OK, but command permissions? stabu Linux - General 2 10-05-2005 12:00 PM
file permissions w/apache php caguru Linux - Newbie 3 04-26-2001 07:52 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 07:46 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration