Hell0
We (our company) has been using one CMS for several websites that we have created. We have encountered this particular problem several times now and we cant think of a fix for it.
Here's the description of the problem: In this cms there is possible to create picture galleries. When you create folder for gallery via CMS then folder is beeing created by www user and its permissions are set to 0666. When user uploads pictures to this gallery using its editor view, then the pictures are uploaded to previously created folder and cut into necessary sizes. .thumbnails and other folders are created to hold pictures of different sizes.
If you create folder for gallery via ftp, then the owner of the gallery is ftp user. If you manually set permissions to 0666 and upload the files with correct permissions, everything seems to be fine. Now in the public view, if you choose this previously created folder as your gallery folder, the cms fails to create .thumbnail subdirectory (and other required subdirectories also). The only difference between the folders is the owner of the folders.
Right now i am trying to get my hands on this hosting accounts php log. I guess i will have more information then.
Alan
You need execute permission to enter a directory in Linux. So you need to set the permission to 7 (rwx) for the web user to enable it to create subdirectories.
Actually, to create subdirs, a user only needs wx privileges on a directory. To be able to fully list the content of the directory, a user needs rx priviliges. To cd into a directory, you definitely need x.
I would try adding apache and the ftp user to same group (usually www-data), this would probably solve this
To make this work, you'll have to share a group between the WWW user and the FTP user something like contentusers. Then you'll have to change the group of the folder to the new contentusers group and set the "SetGID" bit on the directory to (see more http://www.greenend.org.uk/rjk/2004/perms.html ). New files will be created with the proper group.
0666
are pretty bad permissions for directories as you need the--x--x--x
bit to let somebody change into that directory.0777
would be more appropriate (apart from the fact that0777
is only appropriate for a temporary directory and even then it should rather by2777
for that sticky bit).i fixed similar problem with collabtive project management software, you just need to find the class with a method that creates the folders... this could be easy if the code is well commented...
As you can see in this simple explanation of the make dir method (found at www.php.net), when you find it, you'll just need to change the $mode var in your desired value...