Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Can I somehow specify that:

  • in a directory repository.git
  • all files will ALWAYS have
  • mode 770 and
  • git:www-dat a ownwership:groupship?
share|improve this question

2 Answers 2

permissions - mount with ACL options ownership - Your looking at setuid and setgid bits... http://en.wikipedia.org/wiki/Setuid

an example of what it looks like you are trying to do is here: http://www.linuxquestions.org/questions/linux-desktop-74/applying-default-permissions-for-newly-created-files-within-a-specific-folder-605129/

share|improve this answer

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.git

I 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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.