www-数据权限? [英] www-data permissions?

查看:22
本文介绍了www-数据权限?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我在/var/www 中有一个目录(称为 cake),我需要允许 www-data 写入它,但我也想写入它(而不必使用 sudo).我不敢将权限更改为 777,以防我机器上的其他用户(或黑客)尝试修改该目录中的文件.如何只允许我自己和 Apache 的 www-data 访问?

So I have a directory in /var/www (called cake) and I need to allow www-data to write to it, but I also want to write to it (without having to use sudo). I'm afraid to change the permissions to 777 in case some other user on my machine (or a hacker) attempts to modify files in that directory. How do I only allow access for myself and Apache's www-data?

推荐答案

sudo chown -R yourname:www-data cake

然后

sudo chmod -R g+s cake

第一个命令更改所有者和组.

First command changes owner and group.

第二个命令添加了 s 属性,这将使具有相同组权限的蛋糕中的新文件和目录保持不变.

Second command adds s attribute which will keep new files and directories within cake having the same group permissions.

这篇关于www-数据权限?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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