LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 04-10-2015, 12:53 PM   #1
sneakyimp
Senior Member
 
Registered: Dec 2004
Posts: 1,056

Rep: Reputation: 78
permissions for a git repo hosted via SSH?


I now need to set up a repo hosted on my own machine (not github) for a web project. I'm hoping to set up the repo on my server dev.example.com to facilitate development for multiple devs. It will be accessed via SSH by numerous developers. I'm not especially concerned about auto-deployment in this case, but PERMISSIONS are proving to be quite confusing. Per this article, I have gone to my production web root and created a git repo there and committed all my files. I realize when creating this repo that the article I just linked says nothing at all about file permissions. I am expecting to create a bare repo on dev.example.com and expect that any contributor must have a user account on that machine, but am wondering what permissions to assign to the bare repo.

This article has two suggestions and I was wondering what everyone might think. I was prepared to create a new group, developers, add all my devs to this group and set a chmod g+rws on the bare repo's directory, but the article mentions "security issues" which I can quite visualize. Any thoughts would be much appreciated. From the article:
Quote:
Permissions are a pest.

Basically, you need to make sure that all of those developers can write to everything in the git repo.

Skip down to The New-Wave Solution for the superior method of granting a group of developers write capability.

The Standard Solution
If you put all the developers in a specially-created group, you can, in principle, just do:

Code:
chgrp -R <whatever group> gitrepo
chmod -R g+swX gitrepo
Then change the umask for the users to 002, so that new files get created with group-writable permissions.

The problems with this are legion; if you’re on a distro that assumes a umask of 022 (such as having a common users group that includes everyone by default), this can open up security problems elsewhere. And sooner or later, something is going to screw up your carefully crafted permissions scheme, putting the repo out of action until you get root access and fix it up (i.e., re-running the above commands).

The New-Wave Solution
A superior solution—though less well understood, and which requires a bit more OS/tool support—is to use POSIX extended attributes. I’ve only come to this area fairly recently, so my knowledge here isn’t as hot as it could be. But basically, an extended ACL is the ability to set permissions on more than just the 3 default slots (user/group/other).

So once again, create your group, then run:

Code:
setfacl -R -m g:<whatever group>:rwX gitrepo
find gitrepo -type d | xargs setfacl -R -m d:g:<whatever group>:rwX
This sets up the extended ACL for the group so that the group members can read/write/access whatever files are already there (the first line); then, also tell all existing directories that new files should have this same ACL applied (the second line).
 
Old 04-13-2015, 10:53 PM   #2
kbp
Senior Member
 
Registered: Aug 2009
Posts: 3,790

Rep: Reputation: 653Reputation: 653Reputation: 653Reputation: 653Reputation: 653Reputation: 653
Personally I'm not into doing everything by hand, you can miss one step and everything is broken, it's also a real pain when you have to reinstall things. My suggestion in this case would be just to install GitLab CE or equivalent, the admin interfaces make install/management a lot simpler, you get features like developer self-registration etc. and there are packages for Ubuntu/Debian/CentOS
 
Old 04-14-2015, 06:51 PM   #3
sneakyimp
Senior Member
 
Registered: Dec 2004
Posts: 1,056

Original Poster
Rep: Reputation: 78
Quote:
Originally Posted by kbp View Post
Personally I'm not into doing everything by hand, you can miss one step and everything is broken, it's also a real pain when you have to reinstall things. My suggestion in this case would be just to install GitLab CE or equivalent, the admin interfaces make install/management a lot simpler, you get features like developer self-registration etc. and there are packages for Ubuntu/Debian/CentOS
Thanks for the tip. At the moment, I'm the only dev. And there's likely to be only one other dev. Seems a bit overkill to me, but I'll look into it just the same.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Migrate CVS repo to Git vamsi_k Linux - Software 1 08-23-2013 12:30 PM
[SOLVED] Trying to split a large SVN repo into one git repo. Ian John Locke II Linux - Software 1 01-30-2012 08:19 AM
[SOLVED] Ubunutu repo hosted on CentOS. Is that possible? lealsaballos Linux - Server 5 09-29-2011 02:28 PM
[SOLVED] Can't install Git repo (I don't git git ) Nemus Linux - Software 3 05-20-2011 02:09 PM
Best way to automate copying of Git repo to subversion repo? jceipek Linux - Server 0 03-15-2011 02:42 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 06:20 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration