Solved

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

Posted on 2008-10-22
4
400 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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Attention: This article will no longer be maintained. If you have any questions, please feel free to mail me. jgh@FreeBSD.org Please see http://www.freebsd.org/doc/en_US.ISO8859-1/articles/freebsd-update-server/ for the updated article. It is avail…
I promised to write further about my project, and here I am.  First, I needed to setup the Primary Server.  You can read how in this article: Setup FreeBSD Server with full HDD encryption (http://www.experts-exchange.com/OS/Unix/BSD/FreeBSD/A_3660-S…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
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.

827 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