Last active
May 23, 2017 08:33
-
-
Save brysonreece/6f1fc4abaaec44769fd400fddd2f0b94 to your computer and use it in GitHub Desktop.
Fixes file permissions for a Laravel instance
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| if [ -z "$1" ] | |
| then | |
| echo "" | |
| echo "No user supplied!" | |
| echo "USAGE: ./Laravel-Permissions-Fix.sh user group directory" | |
| echo "" | |
| exit 1 | |
| fi | |
| if [ -z "$2" ] | |
| then | |
| echo "" | |
| echo "No group supplied!" | |
| echo "USAGE: ./Laravel-Permissions-Fix.sh user group directory" | |
| echo "" | |
| exit 1 | |
| fi | |
| if [ -z "$3" ] | |
| then | |
| echo "" | |
| echo "No directory supplied!" | |
| echo "USAGE: ./Laravel-Permissions-Fix.sh user group directory" | |
| echo "" | |
| exit 1 | |
| fi | |
| sudo usermod -a -G $2 $1 | |
| sudo chown -R $1:$2 $3 | |
| sudo find $3 -type f -exec chmod 664 {} \; | |
| sudo find $3 -type d -exec chmod 775 {} \; | |
| cd $3 | |
| sudo chgrp -R www-data storage bootstrap/cache | |
| sudo chmod -R ug+rwx storage bootstrap/cache | |
| if [ $3 == "./" ] | |
| then | |
| sudo chmod +x $0 | |
| fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment