I'm trying to set up a secure git repository server using ssh-keys and git-shell. Since our user database is stored in a central LDAP directory, I can't change users' default shell to git-shell, so I've tried prepending the git-shell command to the public key in the authorized_users file like this:
command="git-shell -c $SSH_ORIGINAL_COMMAND" ssh-dss AAAAB3NzaC1kc3...
However, git-shell won't even allow me to clone the repository:
dhcp202:git-ws frank$ git clone ssh://gitserver/var/repos/git/myrepo/
Cloning into myrepo...
fatal: What do you think I am? A shell?
fatal: The remote end hung up unexpectedly
Any ideas appreciated...
I've made a solution using LDAP, OpenSSH (>4.9) and git-shell.
OpenSSH's ForceCommand is perfect for the job. Consider the following configuration (everyone except admins have to use git-shell):
Access control is defined using ACL-s and reponame access groups.
Don't forget to run "nscd -i group", after each change.
Andor
You will find a similar mechanism with gitolite, based on ssh and forced command.
(including ldap queries).
It don't allow interactive shell however,
which could be your issue there.The OP Frank Brenner adds:
That is confirmed in the gitolite forced command script is a Perl one, ending with:
Note the
$repo = "'$REPO_BASE/$repo.git'"
line: it does contains single quotes.This authorized_keys works for me and is properly shell quoted:
man sshd
describes the authorized_keys file format:The same man page describes
restrict
: