Dear all devs,
after beeing asked a lot of times to set permissions on linux file systems in a way that multiple users always have write access to files generated by another user (for example “apache”, “deployment”, dev user), I’d like to give you some idea how you can run this yourself on your laptops or dev server systems:
Here is a code example that sets facl (file access control, some extended permission system) on a directory. This permissions are automatically passed on to files and directories within this directory (even if these get created later):
TARGET="log"
sudo setfacl -R --set u:r.kuehle:rwX,u:48:rwX,u::rwX,g::rX,o::- $TARGET
sudo chown -R root:root $TARGET
for t in $TARGET; do getfacl -p --access $t | sudo setfacl -dRM - $t; done
TARGET: path to one or multiple directories (separate by whitespace)r.kuehle: some example user48: example apache user in a docker container - not known on host system so uid must be usedrwX: permissions, read + write (+ executable for directories and files which are executable, already)getfacl ... | setfacl ... in last line: install acls as default acl