我通过 ssh 设置了一个 git 服务器
http://blog.commonthread.com/post/1034988660/setting-up-a-git-server
但是,我仍然可以通过 ssh 访问服务器并查看服务器上的所有文件夹。您通常如何保护服务器,使 git 用户无法离开主目录并可能造成损害?我读了一些关于 chroot 或 jail 的东西。或者将主目录的权限设置为 700。我想知道实现某些安全性的最简单方法以及如何实现的详细信息。这是在 Centos Linux 服务器上。
有没有办法拒绝命令行访问,同时仍然允许用户从 git 中推送/pull ?
最佳答案
您应该将用户的 shell 设置为 git-shell
.来自文档(实际上,几乎是整个手册页):
This is meant to be used as a login shell for SSH accounts you want to restrict to GIT pull/push access only. It permits execution only of server-side GIT commands implementing the pull/push functionality. The commands can be executed only by the -c option; the shell is not interactive.
(Rup,在评论中,如果你只是用谷歌搜索 git shell...)
关于git - 保护 git 服务器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3116508/