Linode.com Forum Forum Index Linode.com Forum
Linode Community Forums
 


Simple file permission question (I hope)

Click here to go to the original topic

 
       Linode.com Forum Forum Index -> Linux, Apache, Mysql and PHP (LAMP) Forum
Author Message
lostcarpark



Joined: 26 Feb 2007
Posts: 20

Posted: Sun Nov 04, 2007 4:13 am    Post subject: Simple file permission question (I hope)  

I have a PHP website that allows users to upload files, but I also want the site owner to be able to access and change files through FTP.

At the moment the upload folder is owned by the site owner, with permissions of 777. However files uploaded to the folder through the website are owned by apache (nothing unexpected there) but get a permission flag of 664, so world has only read permission.

I could write some PHP to do a chown and/or chmod, but I just want to check if there's a way to do it automatically first.

Is there any way I can set the default permission of new files in the directory to 666?

Alternatively, should I make my FTP users members of the apache group, or would that open a security hole?
Back to top  
sweh



Joined: 13 Apr 2004
Posts: 234

Posted: Sun Nov 04, 2007 6:54 pm    Post subject:  

Create a group and put that user and apache into it.

Now chgrp the directory to that group.

Then "chmod g+s" on that directory.

Now when files appear in there they'll automatically have the right group ownership.
Back to top  
 
       Linode.com Forum Forum Index -> Linux, Apache, Mysql and PHP (LAMP) Forum
Page 1 of 1