I have a user, ftpuser, in a group ftpgroup. I am running apache. A user uploads some files through the website. I have apache create a directory in /home/ftpuser and then the files copy there. This part works. Now this newly created directory, say, "newdir" is owned by apache. I want apache to chown /home/ftpuser/newdir to ftpuser:ftpgroup so the ftp users can access the files.
When I try to do this:
sudo -u apache chown ftpuser:ftpgroup /home/ftpuser/newdir
I get "chown: changing ownership of `/home/ftpuser/newdir': Operation not permitted".
Also, for apache to create the "newdir" directory at all, /home/ftpuser has to have 777 permissions. Obviously there has to be some way to do this without going to 777.