保护 git 服务器的安全
我通过 ssh 设置了一个 git 服务器
http://blog。 commonthread.com/post/1034988660/setting-up-a-git-server
但是,我仍然可以通过 ssh 访问服务器并查看服务器上的所有文件夹。您通常如何保护服务器,以便 git 用户无法离开主目录并可能造成损坏?我读过一些关于 chroot 或监狱的内容。或者将主目录的权限设置为700。我想知道实现某些安全性的最简单方法以及如何做到这一点的详细信息。这是在 Centos Linux 服务器上。
有没有办法拒绝命令行访问,同时仍然允许用户从 git 推送/拉取?
I setup a git server over ssh as
http://blog.commonthread.com/post/1034988660/setting-up-a-git-server
However, I am still able to access the server by ssh and see all the folders on the server. How do you usually secure the server so that the git user cannot get out of the home directory and possibly do damage? I read some things about chroot or jail. Or setting the permissions of the home directory to 700. I would like to know the easiest way to achieve some security and the details on how to do it. This is on a Centos Linux server.
Is there a way to deny command line access while still allowing the user to push/pull from git?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您应该将用户的 shell 设置为
git-shell
。从文档(实际上,几乎整个手册页):(Rup,在评论中,如果你只是用谷歌搜索 git shell...)
You should set the user's shell to
git-shell
. From the docs (indeed, almost the entire man page):(Rup, in the comments, if you'd just googled git shell...)
另一种方法是使用 gitolite 或 gitosis,两者都为您管理此操作并且非常容易配置。
An alternative would be to use gitolite or gitosis, both of which manage this for you and are pretty easy to configure.