SSH Key Authentication in Eclipse

Share this post:

I love Aptana as a PHP IDE which lets me edit remote files, through an SSH/SFTP connection.  However, at the time of this writing, it does not support every kind of SSH exchange algorithm.  When it hits a snag, the exact error message it gives is "No suitable key exchange algorithm could be agreed."  I found this was the case on Acquia servers.

While this can be fixed at the server level, if you are working for a client who does not have access at that level (For example, on an Acquia server), you just can't use Aptana.

Which is where regular old Eclipse comes back into play.

To use public/private key authentication with Eclipse, it is actually fairly simple.

Begin by making sure you have the Remote System Explorer plugins installed, if they didn't already come with your copy of Eclipse.  This post can help you install.  This feature of Eclipse is what will let us connect to another server through SFTP to edit files.

Once installed, we now need to make Eclipse aware of what private keys we have created on our system.  Go to Window -> Preferences, and search for SSH2.  You should see a box like this:

Click the "Add Private Key" button, and find the private keys on your system you wish to add.  You can keep clicking the button to keep adding more private keys.  

IMPORTANT NOTE: If you created your keys in Putty, know that you must export them as OPENSSH format! Eclipse will only accept Private Keys that are in OpenSSH, not the default Putty .ppk format!  In the puttygen program, it's Conversions -> Export OpenSSH.

Back to Eclipse-- Once finished, hit OK, then go to your "Remote Systems" view.  Right-click and say New Connection.  Select SSH Only:

On the next screen, enter your server information.  Once created, right-click on the "Sftp Files" option and click "Properties".  Under Subsystem, you can enter your port, if you need it to be something other than the default:

You will probably want to start in a certain directory when you connect.  To accomplish this, right-click on Sftp Files, select New, then Filter.

Enter the location in the "Folder" box:


When you open your new filter location, you should connect, be prompted for whatever credentials you need to supply, and you're good to go!