DBeaver ssh tunnel invalid private key

I got the SSH Tunnel to work on DBeaver Community Edition Version 7.3.4.202101310933 macOS Catalina version 10.15.7 by doing the following:

in shell: create private 4096-byte RSA key at default location ~/.ssh/id_rsa using ssh-keygen -t rsa -b 4096

in DBeaver:

  • click Help > Install New Software
  • click Add ...
  • enter Name: SSHJ
  • enter Location: https://dbeaver.io/update/sshj/latest/
  • click Next and go thru the entire SSHJ installation process (I failed to do this on my first attempt)
  • click Save
  • click Restart DBeaver

on SSH Tunnel tab of Connection Settings

  • use Authentication Method: Public Key
  • use Private Key: ~/.ssh/id_rsa (OpenSSH NOT PEM, as others have advised)
  • enter Passphrase
  • select Save Password
  • select Implentation: SSHJ
  • click Test tunnel configuration

modal dialog is displayed that says

Connected!
Client version: SSHJ_0.27.0
Server version: OpenSSH_7.2p2 Ubuntu-4ubuntu2.8
  • click OK

The above suggestions didn't help for me. But in the latest versions of DBeaver, you just have to update implementation to SSHJ, under Advanced settings:

enter image description here

That worked for me!


This error is due to the format of the SSH private key. By default, ssh-keygen is creating a private key using the OpenSSH format—with this header:

-----BEGIN OPENSSH PRIVATE KEY-----

But DBeaver only accept keys using the older PEM format—with this header:

-----BEGIN RSA PRIVATE KEY-----

You can either generate a key directly with the correct header using:

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

Or you can convert an existing key (careful! this overwrite the existing key, you can just copy the private key and apply the command on the copy):

ssh-keygen -p -m PEM -f id_rsa

There is an open issue on DBeaver's GitHub.


  1. So at first I've found this solution: https://github.com/rundeck/rundeck/issues/4813#issuecomment-492358649 But I didn't really want to recreate my key, cause it was already in use on several servers.

  2. After an hour of googling I've found another suggestion: to use another SSH implementation via the sshj extension: https://github.com/dbeaver/dbeaver/issues/3917#issuecomment-410616717 It can be installed via the built-in package manager: Help -> Install New Software -> https://dbeaver.io/update/sshj/latest/ And it works great!