Using:
ssh-keygen -O force-command="/bin/restricted-command"
, orcommand="/bin/restricted-command"
at the beginning of anauthorized_keys
line
one can force a key-based SSH connection to execute the given command and no other.
Is it possible through this mechanism (or another) to give someone a limited SSH access to a given git repository, allowing that person to git clone user@server:myrepo.git
, push
or pull
, but nothing else?
Security note: when restricting access with authorized_keys
, you should also use the options: no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-user-rc
gitolite
which manages these details for you. – wurtel Feb 19 at 15:24