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

目录
相关文章
|
1月前
|
安全 网络协议 Shell
Github代码仓库SSH配置流程
这篇文章是关于如何配置SSH以安全地连接到GitHub代码仓库的详细指南,包括使用一键脚本简化配置过程、生成SSH密钥对、添加密钥到SSH代理、将公钥添加到GitHub账户以及测试SSH连接的步骤。
35 0
Github代码仓库SSH配置流程
|
1月前
|
网络安全 开发工具 git
拉取 gitee 代码,配置SSH,Please make sure you have the correct access rights
拉取 gitee 代码,配置SSH,Please make sure you have the correct access rights
34 1
|
24天前
|
网络安全 Windows
在Windows电脑上启动并配置SSH服务
在Windows电脑上启动并配置SSH服务
46 0
|
1月前
|
Ubuntu Shell 网络安全
【Ubuntu】配置SSH
【Ubuntu】配置SSH
41 0
|
1月前
|
安全 Linux 网络安全
在Linux中,如何配置SSH以确保远程连接的安全?
在Linux中,如何配置SSH以确保远程连接的安全?
|
3月前
|
安全 Linux Shell
Linux中SSH命令介绍
Linux中SSH命令介绍
|
1月前
|
安全 Linux Shell
SSH 命令完整实用指南 | Linux SSH 服务
【8月更文挑战第20天】
145 0
|
1月前
|
安全 Linux Shell
如何在 Linux 服务器上配置基于 SSH 密钥的身份验证
如何在 Linux 服务器上配置基于 SSH 密钥的身份验证
39 0
|
1月前
|
Linux 网络安全 数据安全/隐私保护
Linux——配置SSH免密登录
Linux——配置SSH免密登录
30 0