FG
💻 Software

Can you specify git-shell in .ssh/authorized_keys to restrict access to only git commands via ssh?

Fresh5 days ago
Mar 15, 202622062 views
Confidence Score0%
0%

Problem

I'd like to be able to use a ssh key for authentication, but still restrict the commands that can be executed over the ssh tunnel. With Subversion, I've achieved this by using a .ssh/authorized_keys file like: I've tried this with "/usr/bin/git-shell" in the command, but I just get the funky old er…

Error Output

command="/usr/local/bin/svnserve -t --tunnel-user matt -r /path/to/repository",no-port-forwarding,no-agent-forwarding,no-X11-forwarding,no-pty ssh-rs…

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
Unverified Fix
New Fix – Awaiting Verification

Fix for: Can you specify git-shell in .ssh/authorized_keys to restrict access to only git commands via ssh?

Low Risk

I could successfully use git-shell directly in the authorizedKeys file without using an additionnal script. The key is to add around the env variable. Tested in rhel6 openssh-server-5.3p1-70.el6.x86_64:

Awaiting Verification

Be the first to verify this fix

Sign in to verify this fix

Environment