I am running a git server on archlinux. Now I want to give a certain user access to a repository. So I created a user and set its home folder to the repository directory. Now i can checkout the repository using ssh. But the user can also ssh to the server now and see other files. How can i restrict ssh access for that user but allow him to use the repository using ssh? I tried setting the shell to /sbin/nologin but then cloning doesn't work.


use git-shell as the shell in /etc/passwd



If you're using a new enough version of SSH (and you should), this is now a built-in feature. Here's an article on how to set it up.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.