Laravel folder permissions

After installation of Laravel you will require to configure some folder permissions. Currently till Laravel version 5.2 we require to set the permission of 2 folders.

  1. storage
  2. bootstrap/cache

These both folder need writable permission. Because we write the logs in storage folder and save cache in bootstrap/cache folder. Most of the developers set permission 777 to these folders.

Never ever set permission 777 to the folders until it is required. If you are giving 777 permission you are allowing anyone to Read, Write and Execute the files. If you are giving writable and executable permission then it's big security concern.

Now question is what permission should I set to these folders and here is the answer:

Go to terminal and then to you project directory after that run the below commands:

These two commands will set the writable permission to these folders but user will not be able to execute the code.



Rest of the directories require 755 permission and you can set 755 permission to all the folders with the below command:

I used in this command a character  'd'  which denotes that I'm giving permission to directories. We also can set the permission to all the files by running below command:

Here in this command I have used a character 'f' which denotes that I'm giving permission to the files.

Share This:

Leave a Reply

Your email address will not be published. Required fields are marked *