Pankaj Kumar
Pankaj Kumar

Reputation: 101

How do I set write permissions for a directory in AWS for 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.

Upvotes: 0

Views: 9442

Answers (2)

Mayank Pandeyz
Mayank Pandeyz

Reputation: 26288

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)

Upvotes: 5

Pankaj Yadav
Pankaj Yadav

Reputation: 222

run this flowing command on terminal.

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

Upvotes: 4

Related Questions