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

could not settle on kex algorithm - SFTP connection failed #140

Open
raychiranjib1 opened this issue Oct 20, 2022 · 2 comments
Open

could not settle on kex algorithm - SFTP connection failed #140

raychiranjib1 opened this issue Oct 20, 2022 · 2 comments

Comments

@raychiranjib1
Copy link

SFTP connection failed using Net::SFTP client. But it's working with Filezilla and sftp command.

sftp -i ~/.ssh/private_key.pub -P 16321 -oKexAlgorithms=diffie-hellman-group1-sha1 -c aes128-cbc user@host

Code Example:

require 'net/sftp'

sftp = Net::SFTP.start('hostname', 'user', password: '', port: 'port', keys: '~/.ssh/private_key.pub')
sftp.connect

Output:

Failed to connect to hostname: could not settle on kex algorithm

Server kex preferences: diffie-hellman-group1-sha1,diffie-hellman-group-exchange-sha1
Client kex preferences: ecdh-sha2-nistp521,ecdh-sha2-nistp384,ecdh-sha2-nistp256,diffie-hellman-group-exchange-sha256,diffie-hellman-group14-sha1

Is it possible to use any of these Server preferences kex algorithms instead?
Is there any way to define Net::SFTP to use local ssh config?

@brett-novu
Copy link

@raychiranjib1 , the Net::SFTP documentation says that you can use any Net::SSH option. According to VALID_OPTIONS in the Net::SSH documentation, :kex is included as one you can provide.

@brett-novu
Copy link

Also, it appears that Net::SSH uses the standard config files by default: https://rubydoc.info/gems/net-ssh/7.1.0/Net%2FSSH%2Estart

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

2 participants