Created
December 7, 2016 20:01
-
-
Save merolhack/854c3d371f31b21fb6cb538fe02a0444 to your computer and use it in GitHub Desktop.
Set SELinux, ACL and common permissions to Drupal 8 over CentOs 7
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
#!/usr/bin/env bash | |
set -o errexit | |
set -o pipefail | |
set -o nounset | |
# set -o xtrace | |
echo "0.- Reestablecer el contexto" | |
sudo restorecon -Rv /var/www/html | |
echo "1.- Cambiar propietario del webroot de Apache" | |
sudo chown -R apache:apache /var/www/html | |
echo "2.- Cambiar permisos en forma recursiva al webroot de Apache" | |
sudo chmod -R g+w /var/www/html | |
echo "3.- Cambiar permisos sólo al webroot de Apache" | |
sudo chmod g+s /var/www/html | |
echo "4.- Establecer permisos 755 a todos los directorios" | |
sudo find /var/www/html -type d -exec chmod 0755 {} \; | |
echo "5.- Establecer permisos 644 a todos los archivos" | |
sudo find /var/www/html -type f -exec chmod 0644 {} \; | |
echo "6.- Establecer permisos 750 a los archivos del sitio principal" | |
sudo chmod -R 0750 /var/www/html/sites/default/files | |
echo "7.- Establecer permisos de SELinux" | |
sudo chcon -Rt httpd_sys_content_t /var/www/html | |
sudo chcon -Rt httpd_sys_rw_content_t /var/www/html/sites/default/files | |
sudo chcon -Rt httpd_sys_rw_content_t /var/www/html/modules | |
sudo chcon -Rt httpd_sys_rw_content_t /var/www/html/vendor | |
echo "8.- Establecer ACL" | |
sudo setfacl -R -m u:apache:rwx /var/www/html | |
sudo setfacl -R -m d:u:apache:rwx /var/www/html | |
sudo setfacl -R -m g:apache:rwx /var/www/html | |
sudo setfacl -R -m d:g:apache:rwx /var/www/html |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment