question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

"invalid privatekey" connecting through SSH tunnel

See original GitHub issue

Connection specification:

MySQL connection via SSH Tunnel to Ubuntu 16.04 server

Describe the problem you’re observing:

Just done a fresh install on my laptop and now cannot connect to remote server using the new SSH key I generated.

Key was generated like so: ssh-keygen -t rsa -b 4096 -C

I can connect to the server in question just fine via ssh user@host in a terminal but with the same host, user and private key reference under the ‘SSH Tunnel’ tab I get:

Can't initialize tunnel
  Cannot establish tunnel
  Cannot establish tunnel
    invalid privatekey: [B@7696c31f
    invalid privatekey: [B@7696c31f

I added the SSHJ extension after reading through similar issues but it’s not helped

Am I missing something?

System information:

  • DBeaver 6.0.3.201904211926 org.jkiss.dbeaver.core.product
  • DBeaver SSHJ .0.28.201904211926 org.jkiss.dbeaver.net.sshj.feature.feature.group JKISS
  • Host OS: Fedora 30
  • Open SSL version: OpenSSH_7.9p1, OpenSSL 1.1.1b FIPS 26 Feb 2019
  • java -version:
openjdk version "1.8.0_201"
OpenJDK Runtime Environment (build 1.8.0_201-b09)
OpenJDK 64-Bit Server VM (build 25.201-b09, mixed mode)

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:37
  • Comments:44 (8 by maintainers)

github_iconTop GitHub Comments

182reactions
EugeneSmoliycommented, Jun 19, 2019

Run this on your key to convert it to RSA private key. Helped me. ssh-keygen -p -m PEM -f ~/.ssh/id_rsa

80reactions
Kameecodingcommented, Aug 6, 2019

private key generated by ssh-keygen starts with

-----BEGIN OPENSSH PRIVATE KEY----- and not -----BEGIN RSA PRIVATE KEY-----

and this is not supported by DBeaver.

To generate supported key add -m PEM to the end of your ssh-keygen command

e.g.

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

Read more comments on GitHub >

github_iconTop Results From Across the Web

DBeaver ssh tunnel invalid private key - Stack Overflow
I've got an error while trying to establish a new connection through an ssh tunnel using DBeaver (6.1. 2).
Read more >
SSH tunnel com.jcraft.jsch.JSchException: invalid privatekey ...
As I have discovered, when private keys use anything other than the standard "BEGIN/END RSA PRIVATE KEY" declarations, DataGrip is not able to...
Read more >
DBeaver SSH tunnel connections fail with invalid privatekey ...
I tried to connect to a remote Postgresql server with DBeaver and got this error today. The error message said my private key...
Read more >
Why SSH login works in shell but fails in all third parties via ...
UPDATE: It appears that JSCH - Invalid private key confirms that the key is expected to be in OpenSSH format - which is...
Read more >
failed to add ssh key. message [invalid privatekey - You.com
ssh folder. Then, you can connect to remote server from Jenkins UI directly. Open side panel.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found