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.

SSH Tunnel - Cannot run program ssh-keygen error

See original GitHub issue

I have SSHJ 1.0.73 installed and I’m running Dbeaver version 21.0.0.

When trying to set up a DB connection using an SSH tunnel, I get the following error:

Cannot run program "ssh-keygen": error=13,Permission denied error=13,Permission denied

My SSH key is already in OPENSSH format:

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

[...]

-----END OPENSSH PRIVATE KEY-----

What should I do here? Thanks!

Edit: Found the error log

!ENTRY org.jkiss.dbeaver.model 4 0 2021-03-05 10:43:36.928
!MESSAGE error=13, Permission denied
!SUBENTRY 1 org.jkiss.dbeaver.model 4 0 2021-03-05 10:43:36.928
!MESSAGE error=13, Permission denied
!STACK 0
java.io.IOException: error=13, Permission denied
	at java.base/java.lang.ProcessImpl.forkAndExec(Native Method)
	at java.base/java.lang.ProcessImpl.<init>(Unknown Source)
	at java.base/java.lang.ProcessImpl.start(Unknown Source)
	at java.base/java.lang.ProcessBuilder.start(Unknown Source)
	at java.base/java.lang.ProcessBuilder.start(Unknown Source)
	at org.jkiss.dbeaver.model.net.ssh.SSHImplementationJsch.addIdentityKey(SSHImplementationJsch.java:189)
	at org.jkiss.dbeaver.model.net.ssh.SSHImplementationJsch.setupTunnel(SSHImplementationJsch.java:60)
	at org.jkiss.dbeaver.model.net.ssh.SSHImplementationAbstract.initTunnel(SSHImplementationAbstract.java:141)
	at org.jkiss.dbeaver.model.net.ssh.SSHTunnelImpl.initializeHandler(SSHTunnelImpl.java:75)
	at org.jkiss.dbeaver.ui.net.ssh.SSHTunnelConfiguratorUI.lambda$0(SSHTunnelConfiguratorUI.java:216)
	at org.jkiss.dbeaver.ui.UIUtils.lambda$14(UIUtils.java:1657)
	at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:122)

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:14 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
Ernukencommented, Oct 6, 2021
1reaction
cbcoutinhocommented, Mar 10, 2021

Got the debug logs @ShadelessFox, thanks for the link. I’m not comfortable listing the entire log here, but I’d be happy to send you them elsewhere (desktop vs terminal usage).

I found the problem. DBeaver wasn’t able to locate the SSH socket on my client machine to access the agent because I don’ t use the normal ssh socket - I use GPG authentication (via gpg-agent) for SSH access, and the appropriate variable is set in my shell whereas it isn’t available to GUI applications

I had to append the SSH_AUTH_SOCK variable to the desktop file as follows:

--- /usr/share/applications/dbeaver.desktop	2021-03-02 11:22:21.000000000 +0100
+++ /home/chris/.local/share/applications/dbeaver.desktop	2021-03-10 18:00:12.485750751 +0100
@@ -6,7 +6,7 @@
 GenericName=UniversaL Database Manager
 Comment=Universal Database Manager and SQL Client.
 Path=/usr/share/dbeaver/
-Exec=/usr/share/dbeaver/dbeaver
+Exec=env SSH_AUTH_SOCK=/run/user/1000/gnupg/S.gpg-agent.ssh /usr/share/dbeaver/dbeaver
 Icon=/usr/share/dbeaver/dbeaver.png
 Categories=IDE;Development
 WMCLASS=DBeaver

SSH tunnel access used to work, so I’m not sure why I had to make this change.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Dbeaver SSH Tunnel Error - mysql - Ask Ubuntu
This is the answer by EugeneSmoliy on github. Run this on your key to convert it to RSA private key. Helped me. ssh-keygen...
Read more >
DBeaver ssh tunnel invalid private key - Stack Overflow
This error is due to the format of the SSH private key. By default, ssh-keygen is creating a private key using the OpenSSH...
Read more >
Why SSH login works in shell but fails in all third parties via ...
I can connect to 127.0.0.1:6379, i.e., the tunnel is working. Why via third party is this not working? In remote server is running...
Read more >
Problems and Solutions (SSH, The Secure Shell
The commands ssh, scp, ssh-agent, ssh-keygen, etc., aren't doing what I expect. ... When I try to connect to an SSH server, I...
Read more >
SSH Tunneling: Client Command & Server Configuration
SSH port forwarding is a mechanism in SSH for tunneling application ports from the ... It can also be abused by hackers and...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

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