Created
March 2, 2013 15:47
-
-
Save caseyw/5071615 to your computer and use it in GitHub Desktop.
Symfony2 Permissions - Nabbed of a page to ensure I can find the damn thing.
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
Install and enable ACL | |
First you need to install ACL, preferrably through your package manager; aptitude on Ubuntu, pacman on Arch, yum on Fedora, etc: | |
$ sudo aptitude install acl | |
Then you edit your /etc/fstab to enable ACL for your partition. Simply add acl to the list of options. | |
/dev/sda1 / ext4 rw,auto,acl 0 1 | |
Then lastly remount the partition to have the new options take effect. | |
$ sudo mount -o remount / | |
Linux file permissions | |
With ACL enabled for your partition, we can now solve our problem using three ingenious Linux tricks. | |
First we change the ownership of our directories, so that they are owned by our www-data group. | |
$ sudo chown -R :www-data app/cache app/logs | |
Then we set a sticky guid on them. This ensures that new files and directories are automatically owned by the same group as their parent. | |
$ sudo chmod g+s app/cache app/logs | |
Per default new files and directories are not writable by their group owner and so the last piece of our puzzle is to use the previously enabled ACL to change that. | |
$ sudo setfacl -dR -m g::rwX app/cache app/logs |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment