问题描述
我如何添加SSH密钥对Linux的Apache的用户?
How do I add SSH keys for 'apache' user in Linux?
背景
我想添加服务钩GitHub上一次我推到我的回购通知的URL。我有以下PHP页面设置:
I am trying to add a service hook to github to notify a URL once I push to my repo. I have the following php page set up:
<?php `git pull origin master`;
不过,我得到以下的输出:
However I get the following output:
sh: git: Permission denied
这是因为被我的根用户生成对我访问GitHub的生成的密钥。然而,当我从PHP exectue命令是运行它的'阿帕奇'用户。
This is because the keys I generated for github access were generated by my 'root' user. However when I exectue a command from php it is the 'apache' user that runs it.
的按键,因此不符合和权限被拒绝拉。
The keys therefore do not correspond and permission is denied to pull.
由于我不能从终端切换用户生成密钥为'阿帕奇',我也不太清楚该怎么做。任何人都可以提出一个解决方案?
As I cannot switch user from the terminal to generate keys as 'apache', I am not too sure what to do. Can anyone suggest a solution?
推荐答案
由于你是root,你可以尝试苏 - 阿帕奇-cSSH-凯基-t RSA
As you are root, you can try it su - apache -c "ssh-keygen -t rsa"
这篇关于生成SSH密钥'阿帕奇'用户的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!