Download & Extend

directories created with wrong user,group,permissions

Project:ImageCache
Version:5.x-2.2
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:active

Issue Summary

My server is running plesk, and the owner:group for httpdocs and all the drupal directory structure is myftpuser:psaserv.

For some reason when imagecache creates directories they are being created with owner:group apache:apache, and with permission 755, instead of 775. I then find that it is unable to create the modified images.

I have been able to solve the problem temporarily with either of two solutions:

First solution: chmod -R 777 files/imagecache (chmod 775 will not solve the problem without changing the owner:group)
Second solution: chown -R myftpuser:psaserv files/imagecache, and then chmod -R 775 files/imagecache (775 does work here)

Once I make either of these changes, imagecache is now able to create the modified image files, and everything seems to work. The modified images are created with user and group apache:apache, and permission 775.

This is not a long term solution, because it requires manually changing ownerships and permissions everytime a new preset is created and called for the first time.

I have used imagecache on a similar server, (same hosting provider, same setup) and didn't have this problem, though on the other server I wasn't on the latest versions of imagecache, etc.

On the server with the problem I am running the following versions:
Drupal: 5.12
Imagecache: 5.x-2.2
Imageapi: 5.x-1.2
Imagefield: 5.x-2.1

On ther server with NO problem, I am running these versions:
Drupal: 5.9
Imagecache: 5.x-2.1
Imageapi: 5.x-1.2
Imagefield: 5.x-2.1

Any help greatly appreciated!

Thanks,

Steve

Comments

#1

Title:imagecache directories created with wrong user:group, wrong permissions» directories created with wrong user,group,permissions

shortening the title

#2

Category:support request» bug report

Reclassifying as bug. There seems to be some problem with the way the files and directories are being created.

#3

I am having the same problem with 5.x 2.2 and drupal 5.12.

ImageCache creating the category folders with permission 755, but the images with permission 700.

This results in the image being shown correctly the first time that it is requested, but subsequently the user gets a 403 error.

Quick fix is to chmod all the files to 755, but obviously not good in the long run.

#4

How I solveld it (for now)

I changed the owner and group of all files and directories to apache:apache, from httpdocs on down: chown -R apache:apache {drupal root}.

#5

Status:active» fixed

this has been fixed in CVS.

#6

Status:fixed» closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.

#7

Status:closed (fixed)» active

This still seems to be an issue, even with the cvs version.

Like sja1, my site runs on a plesk server and I have no shell access. When imagecache creates files and folders they have owner/group apache and 755 permissions. My drupal site runs under my ftp login name and therefore cannot write to the folders that imagecache creates.

To make the site work I either have to manually delete the imagecache folders and recreate them under my ftp user then change permissions to 777 (775 doesn't seem to work), or raise a support request for the hosting company to change the ownership for me. This wouldn't be too bad if that fixed the issue from then on. My problem is that any change to the imagecache presets flushes the cache, which means it deletes and recreates the folders as owner/group apache.

Is there any way to either:

(a) make imagecache create its folders with 777 permissions so any user can write to the folder (or does that create a security risk?) or

(b) flush the files from the cache without deleting and recreating the folder hierarchy?

#8

I think the second option would be preferable - not re-creating the folder hierarchy. Using 777 permissions would be a real security hole.

I have this problem, with a little bit differently than others. I use suPHP - so my php code runs as one user, and apache runs as www-data. So, imagecache is creating folders owned by my php file, but with 700 permissions, so www-data can't read or write to them.

#9

every time i get my hosting company to change the directories back to 777 and use imagecache it sets the permissions back to 755 and completely locks me out - i can't delete, chmod or anything.

what info do you need from me?

p.s. this is on Drupal 6

imagecache 6.x-2.0-beta8

#10

+1 subscribe

again, on plesk with ftp user credentials, imagecache creating folders with 755 permissions and with apache "www-data" owner so i cannot CHMOD

#11

I think this issue is similar to #276337: ImageCache seems to ignore user access rights.

A workaround mentioned there is to put umask(0002); in your settings.php file (or whatever umask you need to make things work right - you can try umask of 0 and if that works, try umask of at least 02 for a bit more security).