When I run composer create-project laravel/laravel nombre_proyecto
, it gives me the error:
mkdir(): Permission denied
Photo:
All this in ubuntu 18.04 LTS
.
EDIT
when executing:chmod -R 777 /var/www/html
The following error returns:
chmod: changing permissions of '/var/www/html': Operation not allowed
chmod: changing permissions of '/var/www/html/index.html': Operation not allowed
when executingls -l /var/www
Show me:
total 4
drwxr-xr-x 2 root root 4096 May 9 00:12 html
How do I fix this?
when executing
ls -l /var/www
Sample:
Hence what interests us are:
html
.From that first column , this
drwxr-xr-x
means:d
one at the beginning indicates that it is a directory.rwx
are the permissions that the user who owns the directory has,r
= read,w
= write, andx
= execute.r-x
are the permissions that the user group to which the directory belongs has.r-x
ones are the permissions that the rest of the world has.The issue there is that this directory belongs to the superuser
root
, as you can see in the third column of the listroot root
, where the firstroot
refers to the owner user , and the secondroot
to the group that owns that directory.The simplest thing there would be to change the owner user , so that this directory belongs to your user (
shassain
from what can be seen in the screenshot), with which you will achieve the permissionsrwx
that the directory already has assigned to its owner user . You can change the owner of the directory with the command:And when running again
ls -l /var/www
You should see something like this:
And you would already be able to write in that directory
html
, because what the error refers to is that your usershassain
did not have write permission there.try with