对于ownCloud目录,为了方便我一直都是粗略地设置为770或650,用户为Apache,现在说一下细致的设置
www-data
apache
http
wwwrun>
, 组是
www
以下脚本可以帮助你快速进行设置
#!/bin/bash ocpath='/var/www/owncloud' htuser='www-data' htgroup='www-data' rootuser='root' printf "Creating possible missing Directories\n" mkdir -p $ocpath/data mkdir -p $ocpath/assets mkdir -p $ocpath/updater printf "chmod Files and Directories\n" find ${ocpath}/ -type f -print0 | xargs -0 chmod 0640 find ${ocpath}/ -type d -print0 | xargs -0 chmod 0750 printf "chown Directories\n" chown -R ${rootuser}:${htgroup} ${ocpath}/ chown -R ${htuser}:${htgroup} ${ocpath}/apps/ chown -R ${htuser}:${htgroup} ${ocpath}/assets/ chown -R ${htuser}:${htgroup} ${ocpath}/config/ chown -R ${htuser}:${htgroup} ${ocpath}/data/ chown -R ${htuser}:${htgroup} ${ocpath}/themes/ chown -R ${htuser}:${htgroup} ${ocpath}/updater/ chmod +x ${ocpath}/occ printf "chmod/chown .htaccess\n" if [ -f ${ocpath}/.htaccess ] then chmod 0644 ${ocpath}/.htaccess chown ${rootuser}:${htgroup} ${ocpath}/.htaccess fi if [ -f ${ocpath}/data/.htaccess ] then chmod 0644 ${ocpath}/data/.htaccess chown ${rootuser}:${htgroup} ${ocpath}/data/.htaccess fi
注意:其中的网页服务器用户要按照实际使用的系统更改,参见上文。
将以上内容复制下来,粘到一个文本文件中,保存为permission.sh。执行以下命令:
chmod +x permission.sh ./permission.sh
如果上面的脚本不能用,或有特殊需求,可以按照以下原则进行设置。
apps/
目录应该属于网页服务器的用户和组(例如CentOS中用户:apache,组:apache)
config/
themes/
assets/
data/
两个.htaccess文件,root用户都要有读写权限,网页服务器组要有读权限。
本文由 橙叶博客 作者:FrankGreg 发表,转载请注明来源!