var/www/html的适当所有者 [英] Proper owner of var/www/html

查看:75
本文介绍了var/www/html的适当所有者的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在Ubuntu 14.04中运行apache2.我在使用后端FTP的FTP客户端和CMS的权限方面遇到了麻烦.我似乎永远无法正确获得权限. www-data应该是/var/www/html的所有者,并且应该是分配给该组的用户吗?

I am running apache2 in Ubuntu 14.04. I have been having trouble with permissions with FTP clients and CMS that use backend FTP. I never seem to be able to get the permissions right. Should www-data be the owner of /var/www/html and root as a user assigned to that group?

推荐答案

某些CMSes和Wordpress对此特别不利,因为它实际上在使用Web用户的代码中.

Some CMSes and Wordpress is especially bad about that because it's actually in the code to use the web user.

顺便说一句,您永远不需要为FTP使用root. www-data ubuntu上的默认apache用户应该拥有您的Web文件/目录,才能与许多cmses一起正常使用.

BTW you should never need to use root for ftp. www-data the default apache user on ubuntu should own your web files/directory to work properly with many cmses.

所以这是以前的工作,也是我们为遇到相同问题的客户所做的工作.将两个user and group的整个Web根都命名为www-data.

So this is what has worked before and what we did for clients with the same issue. chown the whole web root as www-data for both user and group.

因此,如果您的文档根目录为/var/www/html,请使用cd或将目录更改为/var/www并运行此命令以更改所有文件和目录的所有权.

So if your document root is /var/www/html, cd or change directory to /var/www and run this to change ownership on all files and directories.

chown -R www-data: html/

在仍位于/var/www目录中的情况下,通过运行此命令向文件和目录组添加写权限.

while still in the /var/www directory add write permissions to the group for files and directories by running this command.

find html -type f -exec chmod 664 {} + -o -type d -exec chmod 775 {} +

最后将您的FTP用户添加到www-data组.

Finally add your FTP user to the www-data group.

usermod -a -G www-data username

用您的FTP客户端用户名替换用户名

Replace usename with your FTP client username

现在,此设置应允许您使用管理文件,并且仍允许CMS ftp后端继续运行并写入目录.让我知道这对您有用.

Now this setup should allow you to use manage files and still allow the CMS ftp backend to still function and write to the direc. Let me know how that works for you.

这篇关于var/www/html的适当所有者的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆