-
-
Save Vinai/69dc72b9f4baa2506120 to your computer and use it in GitHub Desktop.
Adjust webserver group name to match your system! (_www is the default Apache httpd usergroup on OS X)
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 | |
[ ! -d app ] && echo "Not in Magento 2 root directory" >&2 && exit 1 | |
echo "Settting group ownership to _www" | |
chgrp -R _www . | |
echo "Setting directory base permissions to 0750" | |
find . -type d -exec chmod 0750 {} \; | |
echo "Setting file base permissions to 0640" | |
find . -type f -exec chmod 0640 {} \; | |
echo "Setting group write and sgid bit permissions for writable directories" | |
find var pub/media pub/static -type d -exec chmod g+ws {} \; | |
echo "Setting permissions for files in writable directories " | |
find var pub/media pub/static -type f -not -name .htaccess -exec chmod g+w {} \; | |
[ -e app/etc ] && echo "Making app/etc writable for installation" | |
[ -e app/etc ] && chmod g+w app/etc | |
echo "Making vendor/bin scripts executable" | |
find -L vendor/bin -type f -exec chmod u+x {} \; | |
echo "Making bin/magento executable" | |
chmod u+x bin/magento |
When using the xargs
approach, you can add the -n
parameter to limit how many arguments are given to each invocation of the utility that xargs should run. e.g. find . -type d -print0 | xargs -0 -n10 chmod 0750
would run chmod with 10 directories at a time.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@Vinai
Looks like its deviated from the recommendation here in the below link
http://devdocs.magento.com/guides/v2.0/config-guide/prod/prod_file-sys-perms.html#mage-owner-two-devel
As per the above link the file permission should have 775. Can you please clarify.