dqc19941228 2016-01-22 23:09
浏览 74
已采纳

在SUPEE 7405补丁之后,Chmod 640用于上传文件

After installing the SUPEE 7405 patch, we noticed a problem uploading images from the admin. All file permissions are being set to CHMOD 640 which makes them inaccessible to all users.

Is there a solution that does not involve rewriting the /lib/Varien/File/Uploader.php file?

  • 写回答

5条回答 默认 最新

  • douwuli4512 2016-01-24 05:00
    关注

    A new version of SUPEE-7405 has been released that resolves this issue:

    http://magento.com/security/patches/supee-7405

    Updated February 23, 2016

    Updated versions of this release are now available. The updates add support for PHP 5.3 and address issues with upload file permissions, merging carts, and SOAP APIs experienced with the original release.

    Note that even without the revised patch, you can fix the issue by using the recommended file permissions (see below).


    Magento expects the webserver to own the site files:

    http://devdocs.magento.com/guides/m1x/install/installer-privileges_after.html#privs-after

    You can resolve this problem by making the webserver the owner of the files.

    chown -R web-server-user-name magento/root/path
    

    The webserver user name is commonly www-data or apache.

    If you follow the instructions in the above link, the webserver will have read access to all files, and write access to media files and var files. This should be all you need for typical site operation. If you need to use Magento Connect you'll have to temporarily give the webserver write access to all files.

    All file permissions are being set to CHMOD 640 which makes them inaccessible to all users.

    Only the webserver user needs access to the files. There is no need to grant any permissions to all users.

    You may want to grant access to a specific user if, for example, you need to edit or upload files via FTP. In this case, what I do is set a user who owns the file system and set the files' group to the webserver:

    cd magento/root/directory
    
    # Set ownership 
    # 'username' should be the file system owner username
    # 'webserver' should be the webserver username
    chown -R username:webserver .
    
    # Give the user read/write access to all files.
    # Give the webserver read access to all files
    find . -type f -exec chmod 640 {} \;
    find . -type d -exec chmod 2750 {} \; 
    
    # Give the user and the webserver read/write access to var and media
    find var/ -type f -exec chmod 660 {} \;
    find media/ -type f -exec chmod 660 {} \;
    find var/ -type d -exec chmod 2770 {} \;
    find media/ -type d -exec chmod 2770 {} \;
    chmod 2770 includes
    chmod 660 includes/config.php
    

    The above commands will give your file system owner read/write access to everything and the webserver read access to everything. The webserver will also be able to write to the media and var directories.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(4条)

报告相同问题?

悬赏问题

  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 下图接收小电路,谁知道原理
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度
  • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测
  • ¥15 ETLCloud 处理json多层级问题
  • ¥15 matlab中使用gurobi时报错
  • ¥15 这个主板怎么能扩出一两个sata口
  • ¥15 不是,这到底错哪儿了😭