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

Invalid Private Key, RSA #79

Open
MBronars opened this issue Mar 1, 2021 · 4 comments
Open

Invalid Private Key, RSA #79

MBronars opened this issue Mar 1, 2021 · 4 comments

Comments

@MBronars
Copy link

MBronars commented Mar 1, 2021

I am trying to use a backend server to run my segmentation, but I am unable to access it with my RSA key. In my standard terminal I am able to ssh into the server just fine using my private key, but for some reason I'm getting an invalid private key error when I try to pass in that file during segmentation. Not sure how to fix this, any advice would be greatly appreciated. Maybe the file needs to be in a different format for U-Net?

@MBronars
Copy link
Author

MBronars commented Mar 2, 2021

Searched around on the internet a bit and found the solution, anyone else facing this issue try the following and hopefully it works like it did for me:

Cause: new openssh libs used to generate keys by default save private keys in a different file format that U-Net can't handle. New file format starts with "-----BEGIN OPENSSH PRIVATE KEY-----", while the old one has a different header "-----BEGIN RSA PRIVATE KEY-----"
Solution: (copy) convert your private key file using:
ssh-keygen -p -f file -m pem -P passphrase -N passphrase
(if the key is not encrypted with a passphrase, use "" instead of passphrase)

It seems like you may face these issues if you are using a newer Mac as your frontend computer

@lucaslovercio
Copy link

Hi! I am having the same issue, in Ubuntu.
the parameter file in your script is the old id_rsa location?
Thanks!

@lucaslovercio
Copy link

Maybe more detail can help to understand our issue, and maybe someone can help us.
We have this line in a ImageJ plugin, inside a loop of a folder:

call('de.unifreiburg.unet.SegmentationJob.processHyperStack', 'modelFilename=' + modeldef + ',Memory (MB):=4000,weightsFilename=' + caffemodel + ',gpuId=GPU 0,useRemoteHost=true,hostname=localhost,port=22,username=lucas,RSAKeyfile=/home/lucas/.ssh/id_rsa,processFolder=process-folder/,average=none,keepOriginal=false,outputScores=false,outputSoftmaxScores=false');

And it ask for the password every time it enters in the loop. It seems it is not recognizing the id_rsa file. After I write the password it works, until the next iteration, asking for it again.

ImageJ_ssh_password

This Plugin acutally owrk in other computer. In mine, I create the id_rsa with
ssh-keygen -t rsa
And when it ask for the passphrase, I put the password for my local server (Is that correct, or no password? because it actually work in both cases).

I tried after that the script in this thread, but nothing changed.

Installed software details:
ssh -V returns OpenSSH_7.6p1 Ubuntu-4ubuntu0.3, OpenSSL 1.0.2n 7 Dec 2017

Thoughts?

@ThorstenFalk
Copy link
Collaborator

You can login to the server using the RSA key from console? Try with a corresponding ~/.ssh/config section for your server specifying the key to use. The RSA key format is of course also relevant as MBronars described. Basically jsch supports only a limited set of authentication methods with a subset of available formats.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants