Scenario
You have a server where you want to welcome other people to push files, say for a family photo album. People have their own user account, so by default they will not be able to read/write from each other's repositories, due to git-annex strict restrictions.
Solution
Setup a shared git repository:
git init shared ; cd shared # you can also do this on an existing git annex repo
git config core.sharedrepository group
chmod g+rwX -R .
chgrp -R $group .
The idea here is to use the new (since ?version 4.20130909) support for git's sharedRepository
configuration and restrict access to a specific group (instead of the default, a single user). You can also this to make the files accessible to all users on the system:
git config core.sharedrepository world
chmod a+rwX -R .
This will make sure that you anyone can operate that git annex repository remotely.
Third party applications
Now if another application that is not aware of git's sharedRepository
configuration (say a ?bittorrent daemon) writes files there, you may want to make sure that the files created are also writable by everyone. This is more tricky, but one way of doing this is with the [[!wikipedia setgid]] bit:
find -type d -exec chmod g+s {} \;
You will also need to start the process with a proper [[!wikipedia umask]] (002
instead of 022
).
I haven't actually tested this part. --anarcat
See also
- setup a public repository on a web site
- ?version 4.20130909
- acl not honoured in rsync remote: why this does not work on encrypted remotes
With a git annex repo on an USB drive and a linux filesystem (e.g. ext4) one often has the problem that users on different machines have different user ids. Thus one always needs to correct the user (chown) or permissions (chmod) before one can write to that repo.
So it would help a lot, if git-annex would respect gits config setting "core.sharedrepository".
From what I can see, the SUID bit seems to work at least. I use the group "floppy" as owner group for my USB drive repos since its group id is the same on all Debian machines and there is no harm to add users to it.