Skip to content

Instantly share code, notes, and snippets.

@charliepage88
Last active January 18, 2020 22:56
Show Gist options
  • Save charliepage88/ca0bb52af0f042801b3b1ccf815bc2e4 to your computer and use it in GitHub Desktop.
Save charliepage88/ca0bb52af0f042801b3b1ccf815bc2e4 to your computer and use it in GitHub Desktop.
Simple shell script to setup unix permissions for Laravel
#!/usr/bin/env bash
cd /var/www/projects/projectname
sudo find storage/ -type f -exec chmod 664 {} \;
sudo find storage/ -type d -exec chmod 775 {} \;
sudo find bootstrap/cache/ -type f -exec chmod 664 {} \;
sudo find bootstrap/cache/ -type d -exec chmod 775 {} \;
sudo chown -R www-data:dev storage
sudo chown -R www-data:dev bootstrap/cache
sudo chmod -R ug+w storage
sudo chmod -R ug+w bootstrap/cache
sudo chmod g+s storage
sudo chmod g+s bootstrap/cache
sudo setfacl -R -dm u:www-data:rwx storage
sudo setfacl -R -m u:www-data:rwx storage
sudo chmod -R g+w storage
sudo setfacl -R -m 'group:dev:rwx' -m 'd:group:dev:rwx' .
php artisan cache:clear
composer dump-autoload
@charliepage88
Copy link
Author

Shell script that will set up permissions for you, at least in Ubuntu, for a Laravel app.

  • Change "dev" to the group name you create.
  • Change "/var/www/projects/projectname" to the root path of your Laravel app.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment