如何为AWS中的ec2-user设置目录的写权限?

如何为AWS中的ec2-user设置目录的写权限?

问题描述:

I have created an instance in AWS with Red Hat Enterprise Linux Server release 7.2 (Maipo) and also install PHP on this server.

I have given permission using this command chown -R apache:ec2-user /var/www/html/ and also give this permission chmod -R 777 /var/www/html/image but folder is not writable this directory /var/www/html/image

Please suggest how can I make the image folder writable.

我在AWS中使用Red Hat Enterprise Linux Server 7.2(Maipo)创建了一个实例,并在此处安装了PHP 服务器。 p>

我已经使用此命令授予了权限 chown -R apache:ec2-user / var / www / html / strong>并且还授予此权限 chmod -R 777 / var / www / html / image strong> 但文件夹不可写此目录 / var / www / html / image strong> p> 请建议如何使图像文件夹可写。 p> div>

run this flowing command on terminal.

setenforce 0
nano /etc/sysconfig/selinux
SELINUX=disabled

First of all check the directory permission by running the following command on terminal:

stat -c '%A %a %n' *

It will give the directory permission like:

-rw-r--r-- 644 \
drwxrwxr-x 775 Code Backup
drwxr-xr-x 755 Desktop
drwxr-xr-x 755 Documents

And again try to change the permission by sudo like:

sudo chown -R apache:ec2-user /var/www/html/ 
sudo chmod -R 777 /var/www/html/image

Note: you must have the rights to change the permission, that's why I added sudo (Super User)