Tried to connect SFTP server using RSA private key with a ruby script. It's not connecting. But it's working using Filezilla.
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
Using sftp command with -oKexAlgorithms argument it's working on the terminal.
sftp -i ~/.ssh/private_key.pub -P 16321 -oKexAlgorithms=diffie-hellman-group1-sha1 -c aes128-cbc user@host