I am trying to use DBeaver to connect to a PostgreSQL database server through SSH:

can't initialize tunnel
cannot establish tunnel
com.jcraft.jsch.JSchException: auth fail

enter image description here

I am sure the SSH server is working fine. I manage to connect to the same PostgreSQL database server through the same SSH server with pgAdmin 3 and RazorSQL. I have checked the IP, username and password, they are correct. I disabled all firewalls. What could be the issue?

My settings:

enter image description here

enter image description here

I use DBeaver 3.7.3 x64 portable version with Windows 7 SP1 x64 Ultimate.

The error log window does not log the error, so I don't have any more information there.


I tried DBweaver on Kubuntu and had the same issue. It looks like the issue is around the fact that the authenticity of the SSH server hadn't been verified beforehand, and DBweaver and unable to cascade the correct error message (e.g., Host key verification failed.) and instead misleadingly blames some authentication error.

I fixed the issue on Kubuntu as follows:

  1. Disable the SSH Tunnel:

enter image description here

  1. Run in the shell sudo apt-get install -y autossh

  2. Add the shell command in your connection in DBeaver:

    autossh -f -N -L 5432:localhost:5432 ssh_server_username@ssh_server_ip

enter image description here

  1. At that point if you try to connect you'll have the same com.jcraft.jsch.JSchException: auth fail error message. Go to the shell and run the command:

    ssh -f -N -L 5432:localhost:5432 ssh_server_username@ssh_server_ip

    it will output:

    The authenticity of host 'ssh_server_hostname (ssh_server_ip)' can't be established.
    ECDSA key fingerprint is 29:13:b5:cb:99:21:b2:18:f1:11:aa:12:54:c2:88:9a.
    Are you sure you want to continue connecting (yes/no)? yes
    Warning: Permanently added 'ssh_server_hostname,ssh_server_ip' (ECDSA) to the list of known hosts.

    Go back to DBeaver, try to connect, that should work. I still don't know why I should use autossh instead of the SSH tunnel tab in DBeaver though.

  • Have the same issue on Windows, have been unable to fix it. Jul 5 '17 at 12:09
  • FWIW, it seems to me that solving the issue "The authenticity of host 'ssh_server_hostname (ssh_server_ip)' can't be established." is the only important part. Franck implies that there is no reason to need autossh rather than plain ssh. And indeed, my experience is that ssh works perfectly well once the server is added to the list of known hosts.
    – mdahlman
    Oct 24 '18 at 16:21

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.