Last active
December 6, 2016 23:07
-
-
Save putWorkDev/5c34167645631386b3bcb2d96317ed85 to your computer and use it in GitHub Desktop.
Files / folders permissions
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
| Permissions in apache: | |
| - folder: 0750/ 0755 | |
| - files: 0640 / 0644 |
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
| Permissions with "selinux" (para uma aplicação de laravel): | |
| chcon -v -R --type=httpd_sys_content_t /var/www/html/pad/ | |
| chcon -R -t httpd_fastcgi_script_exec_t /var/www/html/pad/bin | |
| chcon -R -t httpd_sys_script_rw_t /var/www/html/pad/storage/ | |
| ---- | |
| Folders with read and write should use: "httpd_sys_rw_content_t" instead of "httpd_sys_content_t" | |
| More info: | |
| https://fedoraproject.org/wiki/SELinux/apache | |
| httpd_sys_content_t | |
| - Set files with httpd_sys_content_t for content which is avail- | |
| able from all httpd scripts and the daemon. | |
| httpd_sys_script_rw_t | |
| - Set files with httpd_sys_script_rw_t if you want | |
| httpd_sys_script_exec_t scripts to read/write the data, and dis- | |
| allow other non sys scripts from access. |
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
| Using ACL on a System that Supports setfacl (http://symfony.com/doc/current/setup/file_permissions.html) | |
| $ 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` | |
| # if this doesn't work, try adding `-n` option | |
| $ sudo setfacl -R -m u:"$HTTPDUSER":rwX -m u:`whoami`:rwX /var/www | |
| $ sudo setfacl -dR -m u:"$HTTPDUSER":rwX -m u:`whoami`:rwX /var/www |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment