I am getting a permissions denied error when trying to write to the system/cache
directory for the apache user and group (calling from HTTP :80 via web browser)
当尝试为apache用户和组写入系统/缓存目录时,我将获得一个被拒绝的权限错误(通过web浏览器从HTTP:80调用)
I have the folder permissions set like:
我将文件夹权限设置为:
[ec2-user@ip-172-31-45-8 system]$ ls -lah
total 48K
drwxrwsr-x 10 ec2-user www 4.0K Nov 24 05:05 .
drwxrwsr-x 7 ec2-user www 4.0K Nov 24 04:59 ..
drwxrwsr-x 2 ec2-user www 4.0K Nov 24 05:05 cache
drwxrwsr-x 2 ec2-user www 4.0K Nov 24 04:03 database
drwxrwsr-x 2 ec2-user www 4.0K Nov 24 04:03 engine
-rw-rw-r-- 1 ec2-user www 924 Nov 24 04:03 file_merge.php
drwxrwsr-x 2 ec2-user www 4.0K Nov 24 04:03 helper
drwxrwsr-x 2 ec2-user www 4.0K Nov 24 05:02 library
drwxrwsr-x 3 ec2-user www 4.0K Nov 24 04:53 plugins
-rw-rw-r-- 1 ec2-user www 3.3K Nov 24 04:03 startup.php
Apache Groups are set like this (I realize not a good idea to set apache to root group, but for testing purposes...):
Apache组的设置是这样的(我意识到将Apache设置为根组不是一个好主意,但是为了测试目的……)
[ec2-user@ip-172-31-45-8 system]$ groups apache
apache : www root wheel ec2-user apache
[ec2-user@ip-172-31-45-8 system]$ groups ec2-user
ec2-user : ec2-user wheel apache www
I have a script that tries to write to the system/cache/
directory which permissions are set to rwx
for ec2-user
and www
. Apache is configured to use:
我有一个试图写入系统/缓存/目录的脚本,该脚本将ec2-user和www的权限设置为rwx。Apache被配置为使用:
User apache;
Group apache;
Chaning config to use www
group fixes the problem, but I am confused why I cannot get it to work w/ group apache
??
Chaning config使用www group修复了这个问题,但是我不明白为什么我不能让它在w/ group apache上工作?
User apache;
Group www;
Am I not understanding the way groups work on linux??
我不理解在linux上分组的工作方式吗?
1 个解决方案
#1
2
I'm not a proficient Linux or AWS user, but try adding the apache user to the www group:
我不是一个熟练的Linux或AWS用户,但是尝试将apache用户添加到www组:
sudo usermod -a -G www apache
sudo usermod - - - gwww apache。
Then restart apache:
然后重新启动apache:
sudo service httpd restart
or
或
sudo service apache2 restart
Then confirm apache is part of the www group
然后确认apache是www组的一部分。
grep 'www' /etc/group
That seemed to correct the problem for me. Just an FYI, I set up my EC2 server following these instructions.
这似乎可以纠正我的问题。仅供参考,我按照以下说明设置了我的EC2服务器。
#1
2
I'm not a proficient Linux or AWS user, but try adding the apache user to the www group:
我不是一个熟练的Linux或AWS用户,但是尝试将apache用户添加到www组:
sudo usermod -a -G www apache
sudo usermod - - - gwww apache。
Then restart apache:
然后重新启动apache:
sudo service httpd restart
or
或
sudo service apache2 restart
Then confirm apache is part of the www group
然后确认apache是www组的一部分。
grep 'www' /etc/group
That seemed to correct the problem for me. Just an FYI, I set up my EC2 server following these instructions.
这似乎可以纠正我的问题。仅供参考,我按照以下说明设置了我的EC2服务器。