By strangnet on
How do I make sure that the directories that Drupal creates (i.e. files/tmp, files/images, files/images/temp etc) get the correct uid so that I can change the permissions on them? As it is now, the wrong uid is somehow set so I'm unable to actually upload or delete stuff from these directories.
Comments
Ah, after digging a bit
Ah, after digging a bit deeper I managed to circumvent it by setting chmod with a php-script.
However, the question remains that every time Drupal creates directories they have the wrong uid as owner which I should be able to customize somewhere.
There's no simple solution for this
By nature everything that Drupal creates is created by your web server - so the owner of the directories will be whoever your web server is running as. This is likely going to be a user called apache or httpd or something like that depending on your particular host.
In our case we set up the users so that their own web server runs as their own user - but that is a real oddity and will not be the case with most web hosts.
In other words - this isn't really a Drupal issue, it's an issue with how your web server is configured. More likely you're going to have to figure out a way of dealing with group permissions so that you are in a group that can access the files - but again, this is going to be more dependent on your hosting arrangements than anything else.
Steve Hanson
Principal Consultant Cruiskeen Consulting LLC
http://www.cruiskeenconsulting.com
Steve Hanson
Publisher Eye On Dunn County
https://eyeondunn.com
Not the case otherwise
I would have to say it's a Drupal issue, since both b2evolution and Wordpress works without problems when uploading and deleting files. And since I'm hosted on a shared server with safe mode I don't have much to say what permissions are set. The question is why files that Drupal creates get a different uid than the one Drupal identifies itself when it tries to move or delete them.
tempnam to blame
i have experienced the same issue and can conclude that in my case, the php function tempnam() was to blame. from the manual:
tempnam -- Create file with unique file name
the following alterations to file.inc did the trick
i am well aware that this is only a temporary solution as the filename generated better be unique and not $file->filename. will continue investigating tempnam() as well and anyone seeing any drawbacks of this approach please enlighten me...
Thanks a lot
Thanks a lot
The change of one line code above solved my problem. I was getting this;
warning: tempnam() has been disabled for security reasons in [my path] file.inc
It works fine now.
Thanks a lot