Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.
  1. The pem file is generated by AWS console
  2. I was able to connect using the EC2 remote web interface, using the same pem file
  3. The permission of pem is 600 already

Error..

ssh -i ~/test.pem -v ubuntu@ec2-1-2-3-4.compute-1.amazonaws.com

debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Trying private key: /home/john/test.pem
debug1: PEM_read_PrivateKey failed
debug1: read PEM private key done: type <unknown>
Enter passphrase for key '/home/john/test.pem':

Anyone can help?

share|improve this question
    
Presuming that you know the passphrase, you can remove it with: openssl rsa -in test.pem -out test-nopass.pem (which will prompt you for the passphrase and save the unencrypted key for you). If this is not the case, your key may have been inadvertently modified at some point, in which case, you will need a backup of the original key to get back into those instances using that key. –  cyberx86 Apr 16 '12 at 17:28
    
There is no passphrease. I can use the same pem file in AWS web interface for remote login without any passphrase. –  Howard Apr 16 '12 at 17:51
1  
Depending on how you saved your key, the problem could be line-endings (the Java client is likely more lax than openSSH on this front). This is more likely if you copied and pasted the output (as opposed to redirecting the output). Check the key with openssl rsa -in test.pem -check and (even though you don't have a passphrase) try the command suggested earlier (and then change your ssh command to use the new key file) as it will write the key to a new file (possibly fixing the problem if it is just a line-ending issue, if it can read the file). –  cyberx86 Apr 16 '12 at 18:22
add comment

1 Answer

up vote -3 down vote accepted

If you try to establish a ssh connection from a ssh connection on ec2, use notepad to open .pem file on your local machine. It will work 100% and won't ask you for any passphrase.

share|improve this answer
1  
This answer makes no sense. What specific course of action are you trying to suggest? –  voretaq7 Jun 11 '13 at 0:34
add comment

Your Answer

 
discard

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.