Fix Linux File And Folder Permissions When Using Laravel Forge
If you use Laravel Forge and move some files to another users account (using isolated users), you will have to fix the file and folder permissions.
First step is to set the correct owner. You can do that by running:
sudo chown -R CORRECT_USER FOLDER
Replace CORRECT_USER by the name of the correct user (the ‘isolated’ username) and replace FOLDERby the name of the folder, that contains the desired files and folders (e.g. public).
Next step is to fix the file and folder permissions. The files should have 644, the folders 755 permissions. You can do that by running these commands:
sudo chmod -R 644 FOLDER
sudo chmod -R +X FOLDER
Again, you have to replace FOLDERby the correct name of the folder. The first command sets the permissions to 644 (everyone can read the file / folder, the owner can read and write).
The second command adds the Execute-Flag to all folders, so that the folder permissions become 755 (everyone can read and execute the folder, the owner can read, write and execute).
Related Posts
- Tutorial: Ubuntu 18.04 LAMP Setup for WordPress
- Fix Laravel Forge Site Creation Problems
- Setup Xdebug in Laravel Valet with PHP 7.4 and PHPStorm
- Fix WordPress Subfolder 404 Errors When Using Laravel Forge
- Fix "No application encryption key has been specified." When Using Laravel
- Fix "504 Gateway Timeout" When Using Laravel Valet
- Fix Laravel Valet - MySQL Has Gone Away