Have you ever wanted to give several users permission to work on files within a directory, but then struggled with what permissions and user:group ownership to set them to so users can always edit the files?
You might think the solution is to make the parent directory owned by a common group, lets say dev, and then try and make the permissions flow through to the files within. This doesn’t work though, and new files will still be created with the user’s umask, typically 644, which is no good as it results in the other users not being able to edit the file.
The solution lies in ACLs (Access Control Lists). Thanks to Pelle at Stackoverflow for making such a concise set of steps to set this up. Blatantly copied here:
First add the acl option to the mounted partition where the directory is you want to apply this to. Add the acl option to the mount point in /etc/fstab:
/dev/xvda1 / ext3 errors=remount-ro,acl 0 1
Then remount the filesystem to enable it:
# mount -oremount /
Then set the permissions using the setfacl command:
# setfacl -dm u::rwx,g::rwx,o::r /shared/directory
Test by creating a new file in /shared/directory:
/shared/directory$ touch test /shared/directory$ ls -al test -rw-rw-r-- 1 jason dev 0 Feb 20 12:37 test
Marvel in the wonders of modern filesystems.
Leave a Reply