7/12/2016 - 11:37 AM

Files / folders permissions

Files / folders permissions

Using ACL on a System that Supports setfacl (
$ 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
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:

- Set files with httpd_sys_content_t for content which is avail-
able from all httpd scripts and the daemon.

-   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.
Permissions in apache:
- folder: 0750/ 0755 
- files: 0640 / 0644