Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Folder Permissions the nth one

crazyjunkcrazyjunk New
edited August 2012 in Vanilla 2.0 - 2.8

Hi!

Have installed Version 2.0.18.4 with FileUpload 1.5.2 also testet with 1.5.6(newest version compatible with 2.0) from GitHub.
My 'upload' folder is recursively set to 777. In the FileUpload Script new folders will be generated with 777 also. But when i upload a file with FileUpload plugin all folders/files were made with 664 and aren't readable.

When I set the permissions afterwards to 777 or 775 everything works okay.

Is that an issue in FileUpload plugin or a missconfiguration of my webserver? Tryed everything i can. File permissions on server seams to be okay. All owners and rights are right setted in my mind.

anyone else have this problem?
re-nitializing the plugin doesnt change anything.

thanks. this is an awesome part of software! nice and clean code!

Comments

  • okay. solved the problem by hacking a few lines into de script.
    after creating the folders i changed permissions afterwards with chmod direct in the script:

    if (!is_dir(dirname($SavePath)))
    @mkdir(dirname($SavePath), 0777, TRUE);
    chmod(dirname($SavePath), 0777);
    

    and here:

    if (!file_exists(dirname($TargetPath))) {
    mkdir(dirname($TargetPath), 0777, TRUE);
    chmod(dirname($TargetPath), 0777);
    }
    
  • to repair permissions on the file itself i did this:

    // Move to permanent location
    $MoveSuccess = @move_uploaded_file($FileTemp, $SavePath);
    chmod($SavePath, 0777);
    
  • Where abouts did you modify these? I'm guessing it was in the class.fileupload.plugin as I found the 1st and last ones to edit... But where abouts did you put the "if (!file_exists...." bit???

    I'm on my final straw with this plugin and this forum software.

  • x00x00 MVP
    edited August 2012

    Failure to understand permission properly (including some web hosts, and developers), is reason why people set to 0777 (which is almost never necessary).

    One reason why the folders might not being set under the right permission, is the folder are not owned by the php web user. Typically the web user is www-data. However the permission strategy depend on the gateway interface (e.g. cgi, fastCGI, DSO,suPHP)

    You can create a file called test.php an point it.

     <?php
     echo shell_exec('whoami');
    

    see who the user is (often www-data)

    Then set accordingly.
    e.g.

    $ sudo chown -R www-data:www-data conf
    $ sudo chmod -R 0775 conf
    $ sudo chown -R www-data:www-data cache
    $ sudo chmod -R 0775 cache
    $ sudo chown -R www-data:www-data uploads
    $ sudo chmod -R 0775 uploads
    

    Instead of blaming everyone else, stop the hissy fit for a second, an consider it is you own fault.

    It is a flawed strategy to set permission in php from a development scenario, becuase in many cases you don't have sufficient permission to do so, in fact is is better if the web user can't just set any permissions.

    grep is your friend.

Sign In or Register to comment.