• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer

Mister PKI

SSL Certificates * SSL Tools * Certificate Decoder

  • PKI Training
  • OpenSSL
  • Keytool
  • PKI Tools
    • Apereo CAS
    • SAML
    • OpenID Connect
  • Get expert help

No matching host key type found – SSH and SFTP

July 6, 2023 by Mister PKI Leave a Comment

The purpose of this article is to demonstrate how to use ssh to remotely connect to an older linux host from a newer version of openssh when receiving the no matching host key type found error. The example in this article was used against an older RHEL 6.5 server. Additionally, the article will demonstrate how to make an sftp connection when receiving the same no matching host key type found error.

SSH no matching host key

If you attempt to ssh into an older operating system that doesn’t support modern key algorithms, you may encounter the following error:

Unable to negotiate with <ip address> port 22: no matching host key type found. Their offer: ssh-dss

This error message means that your version of openssh does not support ssh-dss (or whatever the stated algorithm is), and must be included in your ssh command.

To carry on and successfully connect, run the following command.

ssh -oHostKeyAlgorithms=+ssh-dss <user>@example.com

The -oHostKeyAlgorithms option allows you to pass in any supported algorithm.

Again, note that ssh-dss is the algorithm in question here, but can be any algorithm. If RSA, then the algorithm will be ssh-rsa

Alternatively, you can edit the ~/.ssh/config file to include the host key algorithm so that you do not have to manually type it every time.

Host <host>
  HostName <host ip address>
  HostKeyAlgorithms=+ssh-dss

This may also be done in Putty if using Windows or if using the scp command on linux.

SFTP no matching host key

Similarly to ssh, you may encounter the same issue when using sftp due to it’s use of ssh to transfer the file.

The sftp command options will be slightly different.

sftp -o "IdentityFile=<private_key>" -oHostKeyAlgorithms=+ssh-rsa -oPubkeyAcceptedAlgorithms=+ssh-rsa <user>@sftp.example.com

The sftp command requires an additional option, -oPubkeyAcceptedAlgorithms. This option is supported in openssh 8.5 and above. If using an older version of openssh, you may use the -oPubkeyAcceptedKeyTypes option instead.

Conclusion

This article has demonstrated how to recover from the no matching host key type found when using ssh. Let us know in the comments if you have any questions. If this article was helpful, please read more of our content.

linux,  redhat,  ssh

Reader Interactions

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Primary Sidebar

Popular Posts

PKCS12

openssl s_client

Keytool

Keytool list

ECDSA vs RSA

OpenSSL

PKCS7

Certificate Decoder

PKI for DevOps Engineers – Free Training Series

PKI for DevOps Training Hub

Lesson 1 – How TLS and PKI Work

Lesson 2 – Understanding X.509 Certificates

Lesson 3 – Certificate Chains Explained

Lesson 4 – Debug TLS with OpenSSL

Lesson 5 – Verify Certificate Chains

Lesson 6 – Creating CSRs with OpenSSL

Lesson 7 – Working with PKCS12 Certificates

Lesson 8 – Java Keystores and keytool

Lesson 9 – Certificate Expiration Monitoring

Lesson 10 – Automating Certificate Renewal

Lesson 11 – Common TLS Errors

Lesson 12 – PKI Architecture for DevOps

Recent Posts

  • Apache mod_auth_cas: Protect Web Applications with Apereo CAS and Docker
  • Apache mod_auth_mellon: Configure SAML SSO & Docker
  • Configure OpenID Connect (OIDC) in Apereo CAS 7.3 and 8
  • Certificate Ownership Is an Operating Model Problem, Not a Tooling Problem
  • OpenSSL dgst: Create Checksums and Verify Digital Signatures

Footer

  • Twitter
  • YouTube
Mister PKI

Practical security engineering for the systems that establish trust.

Learn OpenSSL Keytool Free training
Work together PKI consulting CAS consulting Sponsored contributions
Site About Support Mister PKI Cookie policy Search
© 2026 Mister PKI Secure systems. Clear guidance.