All files in a directory will have 770 and git:www-data (Linux)
Matthew Barrera
Can I somehow specify that:
- in a directory repository.git
- all files will ALWAYS have
- mode 770 and
- git:www-dat a ownwership:groupship?
2 Answers
permissions - mount with ACL options ownership - Your looking at setuid and setgid bits...
an example of what it looks like you are trying to do is here:
If you can enforce that applications that create files in this directory run with umask 007, and create files with no restriction on permissions, and run with group www-data as their effective or supplementary group, then all you need to do is chmod g+s repository.git. Otherwise, you can't do exactly what you request.
However, if you make the directory itself owned by git:www-data and mode 770, only the git user and the www-data group will be able to access files in the directory. Even if the files in the directory are world-readable, other users won't be able to access them unless they're hard linked elsewhere or you hand them a descriptor to the directory (which you'd pretty much have to do deliberately).
Next is the problem of making the files group-writable. You can do that if the filesystem has access control lists enabled. For ext2/ext3/ext4/reiserfs, make sure it's mounted with the acl options. Install the ACL command line tools (e.g. you need the acl package on Debian or Ubuntu).
chmod 770 repository.git
chown git:www-data repository.git
setfacl -m user:git:rwx -m group:www-data:rwx repository.git
setfacl -d -m user:git:rwx -m group:www-data:rwx repository.gitI don't think the files will end up executable unless the applications create them to be executable. I don't know how to remedy this.