spatie / ray

Debug with Ray to fix problems faster
https://myray.app
MIT License
568 stars 102 forks source link

Cannot connect to ssh using private key with no password #592

Closed weezard closed 2 years ago

weezard commented 2 years ago

Describe the bug Ray ask password for private keys without passwords.

Versions 1.18.3

PHP version: 8.0.6 Laravel version: 8

To Reproduce Steps to reproduce the behavior:

  1. Go to Servers
  2. Create a new server connection and use a Private key without password.
  3. Press save
  4. Connect to the new server connection.

...Ray ask for passphrase. If Save is pressed it ask again.

Expected behavior To immediately connect to the server.

Screenshots

image

Desktop (please complete the following information):

AdrianMrn commented 2 years ago

Same as https://github.com/spatie/ray/issues/582, I'll have a look at this this week.

AdrianMrn commented 2 years ago

Are you sure your private key file is not encrypted with a passphrase? I've just checked, and we only show the prompt in case the error includes one of these three phrases:

Could you try removing the server from the Ray server list and adding it again, or creating a new private key and leaving the passphrase blank and trying with that one?

weezard commented 2 years ago

Very sure is not encrypted with passphrase. I can connect directly to remote server from Terminal with that key.

Also tried removing and re adding the server same error.

Meanwhile i'm using version 1.17.1 which works perfectly.

AdrianMrn commented 2 years ago

I've just tested this thoroughly, and all seems to be working like it should…

  1. Create a new key without a passphrase using ssh-keygen -t rsa, giving it a name and no passphrase
  2. Use this new key as a server's private key path
  3. Try to connect
  4. Get an All configured authentication methods failed error, as expected (as in, it's not asking for a passphrase)

If I run through the same steps but give the key a passphrase, Ray asks for it instead of step 4.

Could you please check if this command asks you for a passphrase ssh-keygen -y -f ~/.ssh/my_key?

weezard commented 2 years ago

You are right. I tried the ssh-keygen -y -f ~/.ssh/my_key command and the private key asks me for a password. I checked why it hasn't asked for a password before and the key was been preloaded by ssh-keygen -K <key> from .zshrc without asking for password. I was able to use it in other apps without asking password. This machine was installed from a company backup.

It's working now with a new key and password. Thank you very much.