Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mac Terminal Keeps Asking for Password When Using PPK with SSH

I am attempting to connect to an Amazon EC2 Server via Mac Terminal. I have a PPK file that does not have a password attached to it, but when I try to connect I get a popup box that says "Enter the password for the SSH Private Key."

So we tried creating a PPK that has a password - but it does not accept the password, it still rejects the connection.

I have a Windows user who is able to connect using the same PPK on Putty.

Has anyone experienced this issue?

like image 223
Chris Avatar asked Feb 21 '12 18:02

Chris


2 Answers

Maybe your problem is with permissions for your key. I know in linux its required to change the permissions.

Taken from the website http://om4.com.au/ssh-rsa-key-pairs-passphrases-leopard/

  1. Clear the contents of your ~/.ssh directory and set the directory permissions to 700 (directories need to be "executable") $ rm ~/.ssh/* $ chmod 700 ~/.ssh

  2. Generate your rsa key pair (there are variations for this, but this is the version I used): $ ssh-keygen -t rsa

  3. Set the permissions for all files in ~/.ssh to 600 $ chmod 600 ~/.ssh

  4. Copy your id_rsa.pub key to your server’s .ssh/authorized_keys file

  5. Add your passphrase to your keychain using this command: $ ssh-add -K (you will see Enter passphrase for [your system]/.ssh/id_rsa: )

like image 75
bwight Avatar answered Oct 06 '22 01:10

bwight


The error Enter your password for the SSH key x can result from using a key of the wrong format (such as a ppk key) in ssh or sftp. This is because it is interpreted as an encrypted ssh key and so prompts for the passphrase, when actually there is no passphrase.

In OS X I was able to simulate this error by simply typing the following into the command line:

sftp -o IdentityFile=randomtextfile mysftpserver.com

The solution is to convert the file using puttygen as suggested by bwight.

like image 27
Benedict Avatar answered Oct 06 '22 01:10

Benedict