Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to connect to server using openssh private key #50

Open
yan0s opened this issue Jan 31, 2020 · 9 comments
Open

Unable to connect to server using openssh private key #50

yan0s opened this issue Jan 31, 2020 · 9 comments
Labels
bug Something isn't working

Comments

@yan0s
Copy link

yan0s commented Jan 31, 2020

I cannot connect using my private key:

snowflake.desktop[1513]: com.jcraft.jsch.JSchException: invalid privatekey: [B@3ae6f693
snowflake.desktop[1513]:         at com.jcraft.jsch.KeyPair.load(KeyPair.java:948)
snowflake.desktop[1513]:         at com.jcraft.jsch.KeyPair.load(KeyPair.java:561)
snowflake.desktop[1513]:         at com.jcraft.jsch.IdentityFile.newInstance(IdentityFile.java:40)
snowflake.desktop[1513]:         at com.jcraft.jsch.JSch.addIdentity(JSch.java:407)
snowflake.desktop[1513]:         at com.jcraft.jsch.JSch.addIdentity(JSch.java:367)
snowflake.desktop[1513]:         at snowflake.common.ssh.SshClient.connect(SshClient.java:62)
snowflake.desktop[1513]:         at snowflake.common.ssh.files.SshFileSystem.connect(SshFileSystem.java:75)
snowflake.desktop[1513]:         at snowflake.components.files.FileComponentHolder.getSshFileSystem(FileComponentHolder.java:306)
snowflake.desktop[1513]:         at snowflake.components.files.browser.ssh.SshFileBrowserView.lambda$render$1(SshFileBrowserView.java:163)
snowflake.desktop[1513]:         at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
snowflake.desktop[1513]:         at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
snowflake.desktop[1513]:         at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
snowflake.desktop[1513]:         at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
snowflake.desktop[1513]:         at java.base/java.lang.Thread.run(Unknown Source)

It's related to this post:
https://stackoverflow.com/questions/53134212/invalid-privatekey-when-using-jsch

@i5o
Copy link

i5o commented Jan 31, 2020

I can confirm that this is happening to me too. Selected my key under ~/.ssh/id_rsa

Exception caught in sftp file browser
com.jcraft.jsch.JSchException: invalid privatekey: [B@38c2c34d
	at com.jcraft.jsch.KeyPair.load(KeyPair.java:747)
	at com.jcraft.jsch.KeyPair.load(KeyPair.java:561)
	at com.jcraft.jsch.IdentityFile.newInstance(IdentityFile.java:40)
	at com.jcraft.jsch.JSch.addIdentity(JSch.java:407)
	at com.jcraft.jsch.JSch.addIdentity(JSch.java:367)
	at snowflake.common.ssh.SshClient.connect(SshClient.java:62)
	at snowflake.common.ssh.files.SshFileSystem.connect(SshFileSystem.java:75)
	at snowflake.common.ssh.files.SshFileSystem.ensureConnected(SshFileSystem.java:39)
	at snowflake.common.ssh.files.SshFileSystem.getHome(SshFileSystem.java:202)
	at snowflake.components.files.browser.ssh.SshFileBrowserView.lambda$render$1(SshFileBrowserView.java:163)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
	at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at java.base/java.lang.Thread.run(Unknown Source)

@subhra74
Copy link
Owner

Thanks for reporting, will look into it

@subhra74 subhra74 added the bug Something isn't working label Jan 31, 2020
@robertpartridge
Copy link

I've had the same problems today with some of the servers I manage. I tested on one of my servers by changing to a different key from another server that worked and the problem resolved - the difference between the two keys being the length of the key. Perhaps a clue into the source of the problem?

@Shivelight
Copy link

Related issue dbeaver/dbeaver#5845, consider using/supporting SSHJ.

@ivan-cc
Copy link

ivan-cc commented Feb 9, 2020

Temporary solution:

private key generated by ssh-keygen starts with

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

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

e.g.

ssh-keygen -m PEM

This works with version 1.0.4

@kdubdev
Copy link

kdubdev commented Oct 23, 2020

Can confirm this is still an issue to date. Existing OpenSSH private keys can be converted to RSA format using the following terminal command where id_rsa is the OpenSSH private key:

ssh-keygen -p -m PEM -f ~/.ssh/id_rsa

Recommend you back-up id_rsa before running the command as the file will be overwritten when converted. Remember to chmod 600 id_rsa or it will be ignored.

OpenSSH seems to be the new standard private key format. Any comment on when/if Snowflake will add support?

Thank you for this program.

@pm25264
Copy link

pm25264 commented Jul 10, 2023

Using Snowflakes for connecting to AWS EC2 unable to connect through .pem files for the new EC2 instances ( through Putty/WINSCP i can login to EC2 with same key). But can connect to Older EC2s with Snowflake with their .PEM files.
Please help.

@Devoscope
Copy link

Devoscope commented Jul 12, 2023

facing the same issue while I am trying to access the new aws instance, i 'm geting an error - Unable to connect to server.

Please look into this.

@MindaugasBernatavicius
Copy link

Holy molly, same issue still persists.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

9 participants