Last active
November 9, 2016 09:24
-
-
Save jkanclerz/085a96d76d8202cd137f16da40c84631 to your computer and use it in GitHub Desktop.
Magento fix http user permission
This file contains 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 | |
HTTPDUSER=`ps axo user,comm | grep -E '[a]pache|[h]ttpd|[_]www|[w]ww-data|[n]ginx' | grep -v root | head -1 | cut -d\ -f1` | |
dirs=('var' 'pub/media' 'pub/static') | |
function fix_permission { | |
sudo chmod -R +a "$HTTPDUSER allow delete,write,append,file_inherit,directory_inherit" $1 | |
sudo chmod -R +a "`whoami` allow delete,write,append,file_inherit,directory_inherit" $1 | |
} | |
for dir in ${dirs[@]}; | |
do | |
fix_permission ${dir} | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment