Ok, the problem is that I am using Pycharm on El Capitan. I am trying to connect to a server that has strict login Kexalgorithms using the newer Key Exchange Algorithms than Pycharm seems to have the capability to use... but here is the catch, I can log in from a terminal, and this same version of Pycharm works on Ubuntu 14.04 (and I can log in from there)

I can log in normally with ssh successfully from a terminal.

When I attempt to log in to the server using Pycharm, I receive the error "Algorithm negotiation fail.

enter image description here

Here is an entry in my /var/log/messages

Jan 22 23:15:56 (none) auth.crit sshd[2520]: fatal: Unable to negotiate with no matching key exchange method found. Their offer: diffie-hellman-group1-sha1,diffie-hellman-group-exchange-sha1 [preauth]'

This has been asked on StackOverflow, but the person seemed to solve the problem for themselves by adding the option to allow this very old version of Diffie-Helman to sshd_config file on the server.

I do not have permission to add the old version of this Diffie-Helman to the sshd_config

I was previously on Yosemite, and thought that doing the upgrade would fix this because of newer ssh and openssl versions, however that did not fix the problem.


  • Using the same version of Pycharm on Ubuntu 14.04, I am able to connect. So it seems that Pycharm is not the problem.
  • I was able to ssh in to the server from my Mac to get that entry log entry


Do I need to update a specific crytpo related library for applications that have ssh capabilities to be able to use these new features?


First: What do you need it for? Wouldn't sshfs do the job better?

Your problem is the opposite. The server offers old (and possibly broken) KeyExchange methods: diffie-hellman-group1-sha1,diffie-hellman-group-exchange-sha1, that are no longer default in current version of openssh server (what is that server? If your sysadmin tells you that it is strict and newer, than it is not true), but should be wokring for clients.

You should try to add to your ~/.ssh/config the line allowing these Kex methods:

KexAlgorithms diffie-hellman-group1-sha1,diffie-hellman-group-exchange-sha1

if it will not help for connections in-app, there might be some other way to force to use local config.

  • I need to set up a python remote debugging session through the Pycharm IDE. Thanks for letting me know that there was no way for in-app connections. I kept digging once I knew there was no other way. It turns out that the issue is in Pycharm afterall. The Jsch library was outdated. Once I updated it, it worked fine. I will delete the question from AskDifferent and repost this question to SO with the answer since I know now it fits more with that community (I'll come back and post the link). – Dan Jan 25 '16 at 4:34

Took me a while to get back here to answer my own questions.

Update the Jsch library

Pycharm version 4 contains a library that has a bug. This bug prevents SFTP communication using certain SSH key-exchange-algorithms with anything other than basic Diffie-Helman-group1* ciphers. So, we need to update the library in order for Pycharm to communicate with our VM. Our VM only allows much more modern keys and prevents the legacy Diffie-Helman-group1* ciphers.

Pycharm 4 has an outdated version of a java library called Jsch that it uses to communicate with SFTP (which is needed to transfer the helper files). To resolve this, we just need to update the library.

The updated library was found at sourceforge and is located at: http://sourceforge.net/projects/jsch/files/jsch.jar/0.1.53/

Versions Affected

  • Mac: Pycharm <= 5
  • Windows: Pycharm <= 5
  • Linux: Pycharm < 4? (this bug does not exist in 4.04 on linux)

Download Steps

  1. Download the copy of Jsch from this page (at the top).
  2. Remove the old version: jsch-0.1.51.jar sudo rm /Applications/PyCharm.app/Contents/lib/jsch-0.1.51.jar
  3. Copy the new library pycharm directory: /Applications/PyCharm.app/Contents/lib cp ~/Downloads/jsch-0.1.53.jar /Applications/PyCharm.app/Contents/lib/.
  4. Restart Pycharm

Note: This was fixed in Pycharm 5, and updating fixed it for my coworkers, but if you have other java based applications, this may help you.

Note: I ultimately found this by digging through the Pycharm's log. I could see that there issues regarding the libary and a few google searches later and I found the library on sourceforge.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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