10

我正在尝试为 Phabricator 配置 SSH 以使 git 运行。我已遵循本手册,但是当我打电话时,echo {} | ssh git@phabricator.mydomain.com conduit conduit.ping我总是得到一个空结果或Permission denied (publickey,keyboard-interactive)..

/etc/ssh-phabricator/sshd_config

AuthorizedKeysCommand /usr/libexec/ssh-phabricator-hook
AuthorizedKeysCommandUser git

Port 22
Protocol 2
PermitRootLogin no
AllowAgentForwarding no
AllowTcpForwarding no
PrintMotd no
PrintLastLog no
PasswordAuthentication no
AuthorizedKeysFile none

/etc/passwd

phd:x:999:999::/var/tmp/phd:/bin/false
git:x:1005:1005::/home/git:/bin/bash

/etc/shadow

phd:!:16135::::::
git:NP:16135:0:99999:7:::

/etc/sudoers

git ALL=(phd) SETENV: NOPASSWD: /usr/bin/git-upload-pack, /usr/bin/git-receive-pack, /bin/false

~/.ssh/config

Host phabricator.mydomain.com
    HostName phabricator.mydomain.com
    Port 22
    IdentityFile /c/Users/.../.ssh/id_rsa_phabricator
    PreferredAuthentications publickey
    User git

更新

我的问题的原因是:

  • 我没有在客户端使用 SSH 密钥。
  • 我没有确保git用户有一个外壳。
4

3 回答 3

3

需要注意的另一件事是路径必须具有正确的权限,AuthorizedKeysCommand否则这也可能导致

Permission denied (publickey,keyboard-interactive)
于 2015-03-10T19:33:18.177 回答
2

您的 ssh 挂钩工作正常 - 首先,您应该确保 git ssh 用户能够 ssh 到正常的 ssh 守护程序 - 这将确保您可以使用该用户登录。

如评论中所述,您很可能有一个糟糕的主目录或糟糕的外壳。

如果一切正常,请确保您已将 ssh 密钥上传到您的个人资料,并且您正在使用此密钥进行连接。

于 2014-03-18T20:50:35.890 回答
0

我跑进了

Permission denied (publickey,keyboard-interactive)

问题也发现了另一个此处尚未提及的原因:SELinux。

如果您在服务器上使用带有“强制执行”策略的 SELinux,您可能会遇到同样的问题。要检查 SELinux 是否负责,请设置

$ setenforce 0

并尝试

$ echo {} | ssh git@phabricator.mydomain.com conduit conduit.ping

再次。

如果它突然工作,但你不想永久禁用 SELinux 或在许可模式下运行它,你可以使用audit2allow解决你的服务器最近遇到的问题:

$ ausearch -m avc -ts recent | audit2allow -M local
$ semodule -i local.pp

此 ausearch 打印来自 SELinux 日志(通常是 /var/log/audit/audit.log )的最近条目,并且 audit2allow 为标记为denied的条目创建策略。确保日志中没有您不想允许的最近条目。

于 2016-05-19T09:44:24.727 回答