So ssh has the option HostKeyAlgorithms. Sample usage:

ssh -o "HostKeyAlgorithms ssh-rsa" user@hostname

I'm trying to get the client to connect using the servers ecdsa key, but I can't find what the correct string is for that.

What command can I use to get a list of the available HostKeyAlgorithms?

ssh -Q key

Unless you have an ancient version of OpenSSH, in which case uhhhh source dive, or run ssh -v -v -v ... and see if what you want appears there.

| improve this answer | |
  • 1
    Heh, looks like I'm on the ancient version. – mpr Aug 14 '15 at 17:39
  • 1
    I get this: ssh: illegal option -- Q – VaTo Aug 14 '15 at 17:52
  • 1
    Hmm, -Q has been there for a few years ftp.ca.openbsd.org/pub/OpenBSD/OpenSSH/portable/ChangeLog though I suppose some folks are slow to update. To the -v -v -v spam! – thrig Aug 14 '15 at 18:00
  • this is nice feature, but it is not an answer to the question. Available algorithms are stated in manual page. – Jakuje Aug 15 '15 at 6:12
  • 1
    Given that I'm on a relatively aged version of Linux now, and it has -Q, and since the man page now states 'The list of available key types may also be obtained using "ssh -Q key".', I'm gonna move this to the answer, assuming it doesn't violate any stack policy. – mpr Jan 15 '19 at 17:50

from the ssh_config manual page:

             Specifies the protocol version 2 host key algorithms that the client wants to use in order of preference.  The default for this option is:


             If hostkeys are known for the destination host then this default is modified to prefer their algorithms.
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.