How to set up the Permission on Laravel file structure.

July 20, 2023 · 1 min read

Permissions are usually denoted with three digits, each representing a different set of permissions:

Each digit can be a number from 0 to 7, which corresponds to a combination of read (4), write (2), and execute (1) permissions. For example, a permission of 755 means that the user can read, write, and execute (4+2+1=7), while the group and others can read and execute but not write (4+1=5).

Steps to Set Up File Permissions in Laravel

Step 1: Setting the Owner and Group

$ sudo chown -R www-data:www-data /path/to/your/laravel/app

Step 2: Setting Directory Permissions

$ find /path/to/your/laravel/app -type d -exec chmod 755 {} \;

Step 3: Setting File Permissions

$ find /path/to/your/laravel/app -type f -exec chmod 644 {} \; 

Step 4: Special Permissions for Storage and Bootstrap/Cache Directories

$ sudo chmod -R 775 /path/to/your/laravel/app/storage 
$ sudo chmod -R 775 /path/to/your/laravel/app/bootstrap/cache 
How to take help with Chat GPT in Exam Preparation?
How to see the exact IP Address when using cloudflare?
Share on Facebook
Facebook
Tweet about this on Twitter
Twitter
Share on LinkedIn
Linkedin
Pin on Pinterest
Pinterest