gpt4 book ai didi

git - gitlab如何防止ssh作为用户git

转载 作者:行者123 更新时间:2023-12-02 14:38:00 24 4
gpt4 key购买 nike

我安装了 gitlab http://gitlab.com/在我的服务器上,我无法理解一件事。

每个 git 服务器的一般建议是用户 git没有有效的外壳,而不是/bin/bash 使用 git-shell。但是,不能为 gitlab 工作而设置此项,并且需要/bin/bash 作为登录 shell。

出于这个原因,我担心用户可以使用他们使用 gitlab 上传的 key ssh 到服务器,但它似乎使用了一些 魔术 这实际上阻止了用户直接登录:

petanb@debian:~$ ssh git@remus
PTY allocation request failed on channel 0
Welcome to GitLab, petr.bena!
Connection to remus closed.

我在/home/git 中检查了 git 用户的整个文件夹, .profile .bashrc.ssh的内容一切正常,那么它是如何做到的呢?它如何阻止用户使用 ssh?那是什么样的 ssh 钩子(Hook)?

最佳答案

这很可能是因为在 remus 服务器上,git 用户的 .ssh/authorized_keys 文件设置了选项 无 pty 在您的 SSH 公钥之前。例如:

no-port-forwarding,no-agent-forwarding,no-X11-forwarding,no-pty ssh-rsa AAAAB3NzaC1yc2EAA..... user@machine

关于git - gitlab如何防止ssh作为用户git,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23130278/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com