11

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?

11
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.

  • Heh, looks like I'm on the ancient version. – mpr Aug 14 '15 at 17:39
  • 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
  • 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 at 17:50
14

from the ssh_config manual page:

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

                ecdsa-sha2-nistp256-cert-v01@openssh.com,
                ecdsa-sha2-nistp384-cert-v01@openssh.com,
                ecdsa-sha2-nistp521-cert-v01@openssh.com,
                ssh-rsa-cert-v01@openssh.com,ssh-dss-cert-v01@openssh.com,
                ssh-rsa-cert-v00@openssh.com,ssh-dss-cert-v00@openssh.com,
                ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,
                ssh-rsa,ssh-dss

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

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.