You could use a ForceCommand
along with Match
:
Match Address 10.1.0.0/16
ForceCommand /usr/bin/git-shell
From man sshd_config
:
Match Introduces a conditional block. ...
The arguments to Match are one or more criteria-pattern pairs or
the single token All which matches all criteria. The available
criteria are User, Group, Host, LocalAddress, LocalPort, and
Address.
ForceCommand
Forces the execution of the command specified by ForceCommand,
ignoring any command supplied by the client and ~/.ssh/rc if
present. The command is invoked by using the user's login shell
with the -c option.
So, the command you specify would be executed using the user's login shell, which must accept the -c
option. The connection is closed when the command exits, so for all practical purposes, that command is their shell.
bash -c git-shell
, orsh -c vim
), the shell exits when the command exits. – muru Oct 26 '14 at 10:29