问题
Phing running on Server A, with this SSH task to connect to server B:
<ssh username="xxxxxx"
host="B"
pubkeyfile="/home/xxxx/.ssh/id_rsa.pub"
privkeyfile="/home/xxxx/.ssh/id_rsa.pem"
command="cd ./public_html/staging; hg pull />
It connects to server B ok, but the hg pull
which tries to connect to server C spits back remote: Permission denied (public key)
.
However manually SSH'ing into server B from A and doing an hg pull
works fine, suggesting Agent Forwarding is working as I'm not running any agent on B, only on A.
Is there a way I can see which public key is indeed being used by B to try to debug this?
回答1:
It seems like agent forwarding is not supported by PHP's SSH2 which Phing's task uses.
Replacing the <ssh>
task with a simple exec task, i.e.,
<exec command="ssh xxxxxx@B 'cd ./public_html/staging; hg pull'"/>
did the trick.
来源:https://stackoverflow.com/questions/21419254/phing-ssh-agent-forwarding