linux - 这些 LAMP 权限安全吗?

标签 linux apache security ubuntu permissions

我有一个 LAMP 服务器,我在其中运行以下命令来设置/var/www 中文件的权限:

groupadd web
usermod -a -G web my_user
chown -R root:web /var/www
chmod -R 775 /var/www
chmod -R g+s /var/www

我的目标是让“web”组的任何成员都可以写入所有文件。有没有一种安全的方法可以在不更改文件所有权的情况下允许文件上传(例如在 Wordpress 中)?注意:这是私有(private)服务器。

最佳答案

仅对目录应用权限的一种方法是使用 find 命令。例如:

# Set the owner and group on everything.
chown -R root:web /var/www

# Make *directories* read/write/execute and set the `sgid` bit.
find /var/www -type d -print | xargs chmod g+rwxs

您不想运行 chmod -R 775/var/www 因为这会使您的所有文件都可执行,这可能不是您想要的。

关于linux - 这些 LAMP 权限安全吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10000023/

相关文章:

php - PHP 5.3.27 中 password_hash 的最佳替代方案?

java - 服务器配置问题

linux - 文件的绝对路径作为 bash 中的变量

linux - 这里文件 : no parameter expansion

mysql - codeigniter - 如果 ip 超过 x 次尝试,则阻止 ip

php - 我创建了一个伪随机生成器,它对密码学安全吗?

linux - 如何计算空格分隔文件中行中数字的总和?

linux - 我需要在多线程读取调用中保护 fd 吗?

java - 创建 QName 时本地部分不能为 “null”

mysql登录问题,用root可以轻松登录,但用root@localhost就不行