Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Message: mkdir(): Permission denied AWS ec2

I am getting the following error in my code.

Message: mkdir(): Permission denied

I have tried other solutions which i found in stackoverflow and following commands:

$ ls -ald /var/www                              
drwxrwsr-x 7 root root 4096 Apr 23 13:58 /var/www
$ ls -ald /var/www/html
drwxrwsr-x 4 root root 4096 Apr 26 10:02 /var/www/html
$

I referred below document of AWS AWS User Guide

Update:- I can create it from command line. Problem is when i execute my php code i am getting this error.

like image 664
Nagendra Prasad Balaka Avatar asked Sep 15 '25 18:09

Nagendra Prasad Balaka


1 Answers

Which user are you logged in as (find out with whoami). The user and group of these directories are root and there is no write permission for "other".

Possible solutions:

  • Use sudo in front of the command to execute mkdir as root
  • Change owner / group to allow your user / group write permission using chown / chgrp
like image 62
cjwfuller Avatar answered Sep 17 '25 18:09

cjwfuller