Sign up ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I'm trying to connect to Amazon EC2 with phing. This is my script.

    <ssh username="ec2-user"
         command="ls -l" />

I've got the PEM key file directly from Amazon, and I generated PUBLIC key file by puttygen. Result:

[PHP Error] ssh2_auth_pubkey_file(): Authentication failed for ec2-user using public key

I've no idea what I'm doing with the key files, but I want it to connect and run ls -l. Anybody had it working?

share|improve this question
The actual PHP command is this: $could_auth = ssh2_auth_pubkey_file($this->connection, $this->username, $this->pubkeyfile, $this->privkeyfile, $this->privkeyfilepassphrase);. What is privkeyfilepassphrase? And why does it need both public and private key files? I think private is enough. That's how ssh/putty is working for me with just private file. –  Slawa Nov 18 '12 at 1:40
I assume you are running Amazon Linux and not Ubuntu? –  platforms Nov 18 '12 at 1:57

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.