Phabricator 配置ssh访问代码仓库

简介:

根据官方文档需要准备3个用户

www-user, daemon-user, vcs-user

本次配置计划使用两个用户

其中www-user和daemon-user使用既有用apache

www-user,daemon-user

php-fpm本身配置的帐号是apache
这里daemon-user也直接使用apache用户。

./bin/config set phd.user apache

设置vcs-user

计划使用git作为用户名

./bin/config set diffusion.ssh-user git

创建用户并设置

useradd git
usermod -p NP git
usermod -s /bin/sh git

配置sudo
执行命令 visudo
增加如下内容

git ALL=(apache) SETENV: NOPASSWD: /usr/bin/git-http-backend,/usr/bin/git,/usr/bin/git-upload-pack,/usr/bin/git-receive-pack,/usr/bin/svnserve,/usr/bin/svn

注意,如果存在

Defaults requiretty

则需要将它注释掉(在行首增加 # )

配置SSH

1.使用端口2222

./bin/config set diffusion.ssh-port 2222

2.创建配置文件

cp ./resources/sshd/phabricator-ssh-hook.sh /usr/libexec/phabricator-ssh-hook.sh
chmod 755 /usr/libexec/phabricator-ssh-hook.sh
cp ./resources/sshd/sshd_config.phabricator.example /etc/ssh/sshd_config.phabricator

编辑配置文件
vi /etc/ssh/sshd_config.phabricator

AuthorizedKeysCommand /usr/libexec/phabricator-ssh-hook.sh
AuthorizedKeysCommandUser git
AllowUsers git

vi /usr/libexec/phabricator-ssh-hook.sh

# NOTE: Replace this with the username that you expect users to connect with.
VCSUSER="git"

# NOTE: Replace this with the path to your Phabricator directory.
ROOT="/opt/phabricator"

3.启动sshd

/usr/sbin/sshd -f /etc/ssh/sshd_config.phabricator
出现错误信息:
Could not load host key: /etc/ssh/ssh_host_dsa_key

解决方法:

ssh-keygen -t dsa -f /etc/ssh/ssh_host_dsa_key

一路回车即可
然后再次启动

重启phd daemon

./bin/phd restart
如果有权限问题,设置目录权限

chown -R apache. /var/tmp/phd
chown -R apache. /var/repo

目录
相关文章
|
2月前
|
网络安全 开发工具 git
配置本地环境以管理Git多账户SSH连接的方法
通过以上步駟设置后, 您可以轻松管理多個 Git 账户并且根据不同项目需求切换 SSH 密匙进行版本控制操作。
292 20
|
4月前
|
网络安全 开发工具 git
GitHub 多账户 SSH 配置指南
本文介绍了如何在同一台电脑上配置多个 GitHub 账户的 SSH 密钥。内容包括:检查现有密钥、生成新的 SSH 密钥、配置 SSH config 文件、将公钥添加到 GitHub、验证 SSH 连接、设置 Git 用户信息、创建工作区目录、使用不同账户克隆仓库,以及为每个仓库配置独立的用户信息等步骤。通过这些操作,可以实现在不同项目中使用不同的 GitHub 账户进行提交和管理。
353 0
|
7月前
|
安全 Linux 网络安全
在Linux(CentOS和AWS)上安装更新的git2的方法并配置github-ssh
经过以上这些步骤,你现在就能在GitHub上顺利往返,如同海洋中的航海者自由驰骋。欢迎你加入码农的世界,享受这编程的乐趣吧!
319 10
|
10月前
|
Devops Shell 网络安全
git使用之如何将一套代码同时推送至github|gitee|gitcode|gitlab等多个仓库-含添加ssh-优雅草央千澈完美解决-提供整体提交代码
git使用之如何将一套代码同时推送至github|gitee|gitcode|gitlab等多个仓库-含添加ssh-优雅草央千澈完美解决-提供整体提交代码
476 16
git使用之如何将一套代码同时推送至github|gitee|gitcode|gitlab等多个仓库-含添加ssh-优雅草央千澈完美解决-提供整体提交代码
|
安全 Shell 网络安全
设置 码云 SSH 推送和拉取代码
设置 码云 SSH 推送和拉取代码
497 0
|
监控 安全 Ubuntu
在Linux中,如何进行SSH服务配置?
在Linux中,如何进行SSH服务配置?
|
网络安全 Windows
在Windows电脑上启动并配置SSH服务
在Windows电脑上启动并配置SSH服务
4181 0
|
网络安全
|
网络安全 Linux 数据安全/隐私保护
不能成功配置ssh信任,提示Agent admitted failure to sign using the key.
不能成功配置ssh信任,提示Agent admitted failure to sign using the key. 问题现象:      做完信任之后要需要输密码: [grid@db01 .
1617 0