Forums

ZFS Images permission problems (3 posts)

  1. M. Landry
    Member
    Posted 1 year ago #

    Hi,

    i regard to resolve a problem with images permissions on file system in WordPress 3.01.

    I'm system admin of a Solaris x86 box, it's running Apache 2.2, Mysql 5.2 and Php 5.2.
    I'm using ZFS file system the aclmode and aclinherit property are set at "passthrough"
    I'm controling all data creation with a umask of 077 so that all files and directory created are 0700
    My php is configured in fast-cgi mod so that apache run in " User:php "(Username/Group)
    I've put 2 zfs ACE on my web directory and file so that Group PHP are allow to read and execute but are deny to write
    1) - group:php:-w-p----------:------:deny
    2) - group:php:r-x---a-R-c--s:fdi---:allow

    I remove the php deny on writing on wp-content directory so that apache can write file in this directory.

    Here comes my problem. When I "Add an image" from my computer with WordPress 3.01, 3 files are created /uploaded on the server in the wp-content/uploads directory.

    1) Images-150x150.jpg
    2) Images-300x249.jpg
    3) Images.jpg

    The 2 thumbnails images inherit the file permission of the directory but the original not.
    I've made some test with a php script that use a mkdir() , fopen(), exec() and other php function and they all inherit permissions fine.

    Can you light me on this one ?

    Wish that's my explanation are clear

    Sincerely

  2. M. Landry
    Member
    Posted 1 year ago #

    After some search in WordPress source code, I notice that the problem is when wordpress use the "move_uploaded_file()" php function.

    This function mean to move a file from the php POST buffer to the location directory.

    The problem with the move thing is that it keep all acl and permission from the source directory/file and bypass the destination directory acl.

    I can only suggest that WordPress dev team use copy() function to replace move_uploaded_file() function. This way all server admin acl and permission will remain for the destination directory

    Tks for reading

  3. M. Landry
    Member
    Posted 1 year ago #

    Just replace move_uploaded_file($file['tmp_name'], $new_file) by copy( $file['tmp_name'], $new_file ) in wp-admin/includes/file.php
    line 337

Topic Closed

This topic has been closed to new replies.

About this Topic