• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
NameHero® Blog

NameHero® Blog

Web Hosting Tips & Resources From NameHero

  • AI Agents
    • OpenClaw
    • Claude Code
    • n8n
    • Hermes Agent
    • Open WebUI
    • Docker
  • Hosting
    • Web Hosting
    • WordPress Hosting
    • WooCommerce Hosting
    • Enterprise Hosting
    • Email Hosting
    • HeroicGuard
    • GPU Hosting
    • Website Builder
  • VPS
    • Managed VPS
    • Unmanaged VPS
    • Flex VPS
  • Reseller
  • Gaming
  • Domains
  • Account
  • Blog Home
  • Categories
  • Authors

How To Fix Host Key Verification Failed On Linux

CJ Saathoff

Published on: July 17, 2024

Categories: Linux Command Line 0

Have you gotten the error message “host key verification failed” when connecting to a remote server and are stuck wondering what it means and how to fix it? If so you have found your way to the right place. In this blog post, we will break down what the error means, possible causes, and the solution.

Table of Contents
  • What Is SSH?
  • What Is A FQDN?
  • What Is Host Key Verification?
    • Possible Causes of The Error
  • Solutions
  • Conclusion
  • Additional Links

What Is SSH?

SSH stands for Secure Shell, it is one method for providing secure commutation over an untrusted network. It can be used for things like remote shell, file transferring, tunneling, and more.

What Is A FQDN?

FQDN stands for fully qualified domain name it is the full domain name assigned to the host for example server.example.com is an FQDN.

What Is Host Key Verification?

Host Key Verification is a security feature that is part of the SSH protocol. It is used to ensure the client you are connecting to is who they say they are. In other words, it is done to help prevent man-in-the-middle attacks.

When you connect to a server you have never connected to over SSH before you will get a message like this:

The authenticity of host ‘198.51.100.133 (198.51.100.133)’ can’t be established.

ED25519 key fingerprint is SHA256:*******************************************.

This key is not known by any other names.

Are you sure you want to continue connecting (yes/no/[fingerprint])?

  • Line 1: This tells us that it could not verify the authenticity of the host you are connecting to.
  • Line 2: Is information about the host key presented when opening the connection
  • Line 3: Tells us the key is not known by any other names. For example, if you connect to the server by a different IP or FQDN.
  • Line 4: The last line is a question, the question being do you want to continue connecting to the server even though the authenticity of the host could not be verified?

If you say yes, then the remote host key is stored in the ~/.ssh/known_hosts file after you log in using the password or SSH keys. That is then checked on when connecting to that host going forward.

Possible Causes of The Error

  • Server Reinstallation or UpgradeWas the Operating System reinstalled or Upgraded? These could cause the system’s host key to be regenerated.
  • Server Key RotationRotating the host key entry might be sometimes required in response to a cybersecurity incident.
  • Changes in DNS or IP AddressIs the FQDN being used pointing at the correct IP address?
  • Corrupt or Edited known_hosts FileBecause the known_hosts file contains the information stored on host keys if this file were edited or to become corrupt it could cause this error.
  • DNS Spoofing or Man-in-the-Middle AttackThis cause is the most concerning of the causes for this message. If someone were to gain control over the domain used to connect or hijack the traffic at a network level they could force you to connect to another server you’re not intending to connect to (possibly stealing login information for the real server in the process).

Solutions

  1. Verify the Server’s Authenticity:Before making changes the first thing you will want to do is to confirm you aren’t being tricked by a man-in-the-middle attack (aka making sure you are connecting to what you think you are connecting to).Assuming DNS is correct elsewhere, are you connecting from a trusted network connection? If you are not please try again from a trusted network. If a trusted network isn’t directly accessible a trusted VPN could be an option.
  2. Remove the Old Key:To remove the old key there are two options first is using ssh-keygen and the second is to manually remove the entries from the known_hosts file.Option 1: Using ssh-keygen run:ssh-keygen -R hostnameOption 2: To manually edit the known_hosts file open the file using your favorite text editor and remove the lines relating to the host you are having issues with.
  3. Connect AgainNow that the old host key has been removed you should be able to connect again and will be prompted to add the correct host key.

Conclusion

The security feature host key verification can help detect man-in-the-middle attacks when connecting to servers you have already connected to before. Although when things don’t work out it means that you will need to determine the cause before you continue. In this blog post, we discussed what the error means, possible causes, and the solution.

Additional Links

Done Reading and looking for things to read? Why not check these links out?

  • Other SSH-Related Posts
  • SSH Manual
CJ Saathoff

Embracing a lifelong passion for technology since childhood, CJ delved into the intricate workings of systems, captivated by the desire to understand the unknown. This innate curiosity led to his discovery of Linux, a revelation that resonated deeply. With more than 7 years of on the job experience, he’s honed his technical skills as a Geek and Senior Linux Systems Administrator.

Related Posts

Linux find with exec: + vs ;

The "find" command is often used with the "exec" command. Here are the two options you can use, and the difference between them.

Nmap Scan Types: How to Scan a Server’s Network

The "nmap" command allows you to scan a remote server and determine its network configuration. Here are the various nmap scan types.

Using Systemctl to Enable Services on Boot on Linux

You can use the systemctl tool to start services automatically on boot. We do this using the "enable" keyword.

How to Use zsh Syntax Highlighting

In an earlier post, we discussed the basics of zsh, what it is, and how to get started. Today we’ll look at syntax highlighting in zsh, its meaning, and how to implement it. I’ll also explain why it doesn’t work well with bash, even though we can get it to work in a “hacky” way. […]

Reader Interactions

Leave a Reply Cancel reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Primary Sidebar

Follow & Subscribe

Exclusive promos, content and more!


Most Popular Posts

NameHero’s Recommended WordPress Plugin and Theme Setup

WordPress Hosting vs. Web Hosting – What’s The Difference?

How To Increase The InnoDB Buffer Pool Size

How To Fix A Stuck All-in-One WP Migration Import

How To Add A Subdomain In Cloudflare

Top Categories

  • WordPress
  • WordPress Tutorials
  • OpenClaw Hosting
  • Enterprise Hosting
  • WooCommerce
  • Web Hosting
  • Resellers
  • Website Security
  • Website Development
  • Website Performance
  • VPS Hosting
  • SEO Tips
  • Announcements
  • Domain Registration
NameHero

NameHero® proudly provides web hosting to over 40,000 customers with 99.9% uptime to over 750,000 websites.

  • Master Card
  • Visa
  • American Express
  • Discover
  • Paypal
Products
  • Web Hosting
  • Managed VPS Hosting
  • Unmanaged VPS Hosting
  • Flex VPS Hosting
  • WordPress Hosting
  • WooCommerce Hosting
  • Reseller Hosting
  • Enterprise Hosting
  • GPU Hosting
  • Email Hosting
  • HeroicGuard
  • Domains
  • Website Builder
  • AI Agent Hosting
Help & Support
  • NameHero Blog
  • NameHero Gaming Blog
  • Support
  • Help Center
  • Migrations
  • Affiliates
  • Gaming Affiliates
  • Call 1-855-984-6263
Company
  • About Us
  • Contact Sales
  • Reviews
  • Uptime
  • We're Hiring

Copyright © 2026 Name Hero, LLC. All rights reserved.
NameHero® is a registered trademark.

  • Privacy Policy
  • Terms of Use
  • Acceptable Use Policy
  • Payment Policy
  • DMCA