Solved

Change permission of http uploaded file FROM www using PHP chmod function on FreeBSD

Posted on 2008-10-22
4
398 Views
Last Modified: 2013-12-06
Files uploaded via http and moved via a PHP script are currently given the owner www:www.

I need these files to belong to a different user so they count towards their file quota and not toward www's.

I intend to use PHP's chmod function to change the owner but I appreciate that without some changing of privileges on the server this will not be possible.

The server is running FreeBSD. I have root access. What permissions do I need to add/change on the server to allow PHP, running as www, to change the owner of files belonging to www:www?
0
Comment
Question by:mikely
4 Comments
 
LVL 6

Expert Comment

by:Twisteddk
ID: 22784769
Offhand, the user/program executing the change need to be a part of the group www and the file must have +w permissions set for the group, then it should work.
0
 
LVL 51

Accepted Solution

by:
ahoffmann earned 125 total points
ID: 22785004
> I need these files to belong to a different user ..
only root can do a chown (except the OS is configured highly insecure)
0
 
LVL 62

Expert Comment

by:gheist
ID: 22785775
You can make shid directory and use umask 0007 inside php, so you have special group where to add users to write web files.
0
 

Author Closing Comment

by:mikely
ID: 31508997
It wasn't so much a solution as telling me what I was trying wouldn't work but offering no suggestion of how I might otherwise achieve the same affect.
0

Featured Post

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
What are recommended OS for exim mail server? 10 111
HHTP and HTTPS redirect question 3 111
How to Insert a File Using Text Editor 9 90
Bash Script to Analyze Oracle Schemas 11 107
If you are running a LAMP infrastructure, this little code snippet is very helpful if you are serving lots of HTML, JavaScript and CSS-related information. The mod_deflate module, which is part of the Apache 2.2 application, provides the DEFLATE…
If your site has a few sections that need to be secure when data is transmitted between the server and local computer, such as a /order/ section for ordering or /customer/ which contains customer data, etc it would of course be recommended to secure…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.

803 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question