Skip to content

Instantly share code, notes, and snippets.

@m4s0
Last active December 15, 2015 20:59
Show Gist options
  • Save m4s0/937243d67183ea21ec09 to your computer and use it in GitHub Desktop.
Save m4s0/937243d67183ea21ec09 to your computer and use it in GitHub Desktop.
Symfony 2.* init permissions folders
#!/usr/bin/env bash
HTTPDUSER=`ps aux | grep -E '[a]pache|[h]ttpd|[_]www|[w]ww-data|[n]ginx' | grep -v root | head -1 | cut -d\ -f1`
FOLDERS="app/cache app/logs app/sessions"
sudo setfacl -R -m u:"$HTTPDUSER":rwX -m u:`whoami`:rwX $FOLDERS
sudo setfacl -dR -m u:"$HTTPDUSER":rwX -m u:`whoami`:rwX $FOLDERS
sudo chown -R `whoami`:`whoami` $FOLDERS
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment