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月前
|
消息中间件 安全 Unix
SSH配置多台服务器之间的免密登陆以及登陆别名
SSH配置多台服务器之间的免密登陆以及登陆别名
52 1
|
1月前
|
网络安全
检查使用IP协议远程维护的设备是否配置SSH协议,禁用telnet协议
检查使用IP协议远程维护的设备是否配置SSH协议,禁用telnet协议
36 0
|
12天前
|
Shell 网络安全 开发工具
github多用户ssh配置
在Windows 10环境下,当需使用多个GitHub账号进行开发操作时,可通过生成多个SSH密钥对并配置SSH `config` 文件实现。步骤包括:1) 使用`ssh-keygen`命令为每个账号生成密钥对,保存在`C:\Users\<USERNAME>\.ssh`目录;2) 编辑`config`文件,设定每个Host对应的身份文件和用户信息,如果需要,配置代理;3) 验证通过`git clone`不同仓库来确保配置正确。
22 0
|
1月前
|
算法 安全 Shell
SSH:加密安全访问网络的革命性协议
SSH:加密安全访问网络的革命性协议
72 9
|
23天前
|
安全 Shell 网络安全
GitHub SSH 快速配置
这是一个自动化脚本,用于简化设置 Git SSH 连接的过程。功能包括:设置 Git 用户名和邮箱、生成新的 SSH 密钥、将 SSH 私钥添加到 ssh-agent、可选复制 SSH 公钥到剪贴板、提供 GitHub 配置指引以及测试 SSH 连接。用户需确保安装 Git 和 SSH 工具,然后下载脚本并赋予执行权限,按照提示操作即可。适合 Git 初学者或需要快速配置 SSH 的用户。
|
1月前
|
网络安全
|
1月前
|
弹性计算 运维 Shell
基于key验证多主机ssh访问
【4月更文挑战第30天】
25 1
|
1月前
|
存储 网络协议 Linux
如何使用内网穿透工具实现远程SSH访问Deepin系统
如何使用内网穿透工具实现远程SSH访问Deepin系统
|
1月前
|
网络协议 安全 Shell
配置ssh服务
配置ssh服务
|
1月前
|
Shell 网络安全 开发工具
配置SSH时候,Permission denied问题解决方法
配置SSH时候,Permission denied问题解决方法
68 4