Answer the question
In order to leave comments, you need to log in
How to prevent git user from ssh login?
There is OpenSSH, the repository address looks like this [email protected]:/home/git/project.git. Key authorization. How to make it so that they can commit, but not access the server via ssh.
Answer the question
In order to leave comments, you need to log in
Set as a shell to git-shell users. Allows you to work with git, but firmly prohibits all other operations.
You can create a group for these users, describe the block in the sshd config for this group:
Match Group gitusers
ForceCommand git_restricted
X11Forwarding no
AllowTcpForwarding no
AllowAgentForwarding no
PermitTunnel no
Where git_restricted is a script in your favorite language that will analyze the command that the user tried to run, and which will be in the SSH_ORIGINAL_COMMAND environment variable, and if it is one of the required commands (git-receive-pack, git-upload-pack, git-upload-archive) it will execute it with the required arguments.
If you search, there are ready-made solutions. Although writing something is not a problem.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question