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

Jar*_*red 9 php patch file magento

安装SUPEE 7405补丁后,我们发现从管理员上传图像时出现问题.所有文件权限都设置为CHMOD 640,这使得所有用户都无法访问它们.

有没有涉及重写/lib/Varien/File/Uploader.php文件的解决方案?

Mat*_*ley 6

已发布新版SUPEE-7405以解决此问题:

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

2016年2月23日更新

此版本的更新版本现已推出.这些更新增加了对PHP 5.3的支持,并解决了与原始版本相关的上载文件权限,合并购物车和SOAP API的问题.

请注意,即使没有修订的补丁,您也可以使用推荐的文件权限来解决问题(请参阅下文).


Magento希望网络服务器拥有网站文件:

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

您可以通过使Web服务器成为文件的所有者来解决此问题.

chown -R web-server-user-name magento/root/path
Run Code Online (Sandbox Code Playgroud)

网络服务器用户名通常是www-dataapache.

如果您按照上述链接中的说明操作,则Web服务器将具有对所有文件的读取权限,以及对媒体文件和var文件的写入权限.这应该是典型站点操作所需的全部内容.如果您需要使用Magento Connect,则必须暂时授予Web服务器对所有文件的写入权限.

所有文件权限都设置为CHMOD 640,这使得所有用户都无法访问它们.

只有Web服务器用户需要访问这些文件.无需向所有用户授予任何权限.

例如,如果您需要通过FTP编辑或上载文件,则可能需要授予对特定用户的访问权限.在这种情况下,我所做的是设置拥有文件系统的用户并将文件组设置为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
Run Code Online (Sandbox Code Playgroud)

上述命令将为您的文件系统所有者提供对所有内容的读/写访问权限,以及Web服务器对所有内容的读取权限.Web服务器还可以写入media和var目录.