Ssh – Create SSH user with limited privileges to only use Git repository

gitsshuser-management

I have a git repository hosted on my SunOS server, that I remotely use through ssh

git clone ssh://myUser@mydomain.com/path/to/git

Now I need to add more users to be able to access that repository, but not sure how.

I have added one testUser to ssh, but I can't seem to limit that user privileges to only use git.

testUser is able to ssh through and browse the entire server.

How can I create users that can only access git remotely, to clone/pull/push etc…

thanks

Best Answer

You might consider using gitolite under a single user instead of setting up multiple git-shell users (and the required group and group permissions so they can share access to the repositories).

gitolite runs under a single, normal user on the server and uses SSH public keys to differentiate access to Git repositories (see “how gitolite uses ssh” for some of the details of how gitolite does its SSH-based identification). gitolite offers per-repository, per-branch, and even some per-path access control.