Fix - DBeaver SSH tunnel connections fail with invalid privatekey error

Invalid privatekey error in DBeaver

I tried to connect to a remote Postgresql server with DBeaver and got this error today. The error message said my private key was invalid. To check this further, I tried to login to the server using the terminal as usual and it worked. So I realized the issue must be in DBeaver, and not in my private key.
After a few google searches, I learned that DBeaver does not support new OpenSSH private keys format by default. So as a workaround, I had to convert my key file to old PEM format using the following command and use it with DBeaver.

This will work if you already generated the keys with new format and want to use them with DBeaver.

ssh-keygen -p -m PEM -f ~/.ssh/id_rsa
If you want to generate new keys, use the following.

ssh-keygen -t rsa -b 4096 -m PEM

That’s it. I hope this will help someone.

3 comments :

  1. I have been married with my wife for 6 years and recently she broke up with me and it hurt me deeply when she told me to leave her alone and that she does not love me anymore when i was always faithful and honest to her. I tried all the ways to get her back buying her what she wants like i always did and she still left me heart broken and she even has a new boyfriend which destroyed me even more until a friend of mine from high school directed me to Dr Emu. This man changed my life completely. I followed everything he told me to do and my wife came back. I was stunned everything happened exactly like he told me. I had faith in everything he told me and everything was true. You can contact him via email: Emutemple@gmail.com He will help you in anything you need and quick to answer once you contact him through his whats-app number: +2347012841542
    For more destails about Dr Emu you can visit his Website: http://emutemple.website2.me/

    ReplyDelete
  2. after covert, the following error was showed, SSH_MSG_DISCONNECT: 2 Too many authentication failures

    ReplyDelete
  3. Thank you so much!
    Your solution worked for my case!

    My scenario:
    MacOS 10.13.6
    DBeaver 7.2.3
    SSH private key == ECDSA 521 SHA256
    SSH client (ssh -V) == "OpenSSH_7.8p1, LibreSSL 2.6.2"
    SSH server (sshd -V) == "OpenSSH_7.4p1, OpenSSL 1.0.2k-fips 26 Jan 2017"

    ReplyDelete