需要什么权限才能运行Magento?

需要什么权限才能运行Magento?

问题描述:

Magento documentation tells us to do this需要什么权限才能运行Magento?

chmod -R o+w media var 
chmod o+w app/etc 

这就使我们过去的安装程序。

接下来,我想从Magento Connect下载一个主题。不幸的是,这是抛出一个似乎是权限相关的错误。

Settings has not been loaded. Used default settings 
Config file does not exists please save Settings 
Warning: Your Magento folder does not have sufficient write permissions. 

需要什么权限才能通过?

我还看到有关连接字符串的错误。

Connection string is empty 

虽然我们在这,是什么权限的总集,必须设置为使Magento的全功能(和安全)?

我意识到Magento!= Wordpress。它与Wordpress的安装非常接近。只要多一点点!

+1

可用的信息吨那里上设置Magento的权限。在使用Magento Connect之前将所有内容设置为777并不罕见,然后在您安装完所需内容后将权限恢复为建议。 – pspahn 2012-02-11 23:00:05

如果你是一个开发环境,这是要走的路:

chmod -R 777 /magento-directory/ 

否则这应该这样做:

find . -type f -exec chmod 644 {} \; 
find . -type d -exec chmod 755 {} \; 

第一行会发现文件夹,并将文件模式为755。第二个查找文件并将它们chmod改为644.

更多来自Magento wiki article

+0

好的。得到它了。这似乎并不完全安全。是否还有其他文档提到更精细的权限? – 010110110101 2012-02-12 05:01:41

+0

上面的查找和来自Magento的东西都是Magento的适当权限,只要这些文件是由Web服务器运行的用户所拥有的即可。包含在Magento中的.htacess锁定了不应该从Web服务器上看到的内容。 – 2012-02-14 01:15:47

+0

@VernBurton,那么设置'chown ftpuser:www-data public_html -R'然后用'664'和'775'完成上述操作是有意义的吗? – 2012-05-22 10:53:10

我使用以下脚本,并且每隔一段时间运行一次。

将来,我要将chown -R root.www-pub添加到它的末尾,将所有必须修改代码的用户添加到www-pub组,并将umask设置为0002与此同时,下面的脚本运行良好。

#!/bin/bash 

if [ ! -f ./app/etc/local.xml ]; then 
    echo "-- ERROR" 
    echo "-- This doesn't look like a Magento install. Please make sure" 
    echo "-- that you are running this from the Magento main doc root dir" 
    exit 
fi 

if [ `id -u` != 0 ]; then 
    echo "-- ERROR" 
    echo "-- This script should be run as root so that file ownership" 
    echo "-- changes can be set correctly" 
    exit 
fi 

find . -type f \-exec chmod 644 {} \; 
find . -type d \-exec chmod 755 {} \; 
find ./var -type d \-exec chmod 777 {} \; 
find ./var -type f \-exec chmod 666 {} \; 
find ./media -type d \-exec chmod 777 {} \; 
find ./media -type f \-exec chmod 666 {} \; 
chmod 777 ./app/etc 
chmod 644 ./app/etc/*.xml 
+0

您是否曾为新用户组进行过修改? – KPheasey 2015-07-06 13:39:45

使用下面的命令来设置权限,由官方文档的建议:

find . -type f -exec chmod 400 {} \; 

find . -type d -exec chmod 500 {} \; 

find var/ -type f -exec chmod 600 {} \; 

find media/ -type f -exec chmod 600 {} \; 

find var/ -type d -exec chmod 700 {} \; 

find media/ -type d -exec chmod 700 {} \; 

chmod 700 includes 

chmod 600 includes/config.php 

我也写了一个完整的shell脚本自动化这些任务:mage-set-perms

作为奖金脚本也对安全和数据完整性工具如tripwire和助手等方面很温和。

下面的链接适用于设置许可在Magento

这是我们需要为Magento运行的权限。

find . -type f -exec chmod 644 {} \; 
find . -type d -exec chmod 755 {} \;  
find ./var -type d -exec chmod 777 {} \;  
find ./media -type d -exec chmod 777 {} \; 
chmod 777 ./app/etc    
chmod 644 ./app/etc/*.xml  

http://www.letsknowit.com/permissions-needed-to-run-Magento

+0

尽管这个链接可能回答这个问题,但最好在这里包含答案的重要部分,并提供供参考的链接。如果链接页面更改,则仅链接答案可能会失效。 – 2016-05-19 05:20:28