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

sharadchhetri

Tutorials On Linux, Unix & Open Source

  • Home
  • Linux Commands
  • Resources
    • Learn Linux
  • My WordPress plugins

error: Could not load host key

January 17, 2015 by Sharad Chhetri

Recently while upgrading the OpenSSH server, we faced some issue. This time, the issue was related to ssh key and we got number of lines in message log file with information – “error: Could not load host key” .

Here are some brief detail taken from our system.

Jan 17 11:14:10 localhost sshd[6294]: error: Could not load host key: /etc/ssh/ssh_host_rsa_key
Jan 17 11:14:10 localhost sshd[6294]: error: Could not load host key: /etc/ssh/ssh_host_ecdsa_key
Jan 17 11:14:22 localhost sshd[6296]: error: Could not load host key: /etc/ssh/ssh_host_rsa_key
Jan 17 11:14:22 localhost sshd[6296]: error: Could not load host key: /etc/ssh/ssh_host_ecdsa_key
Jan 17 11:15:05 localhost sshd[6305]: error: Could not load host key: /etc/ssh/ssh_host_rsa_key
Jan 17 11:15:05 localhost sshd[6305]: error: Could not load host key: /etc/ssh/ssh_host_ecdsa_key

Solve “error: Could not load host key”

We have couple of method to solve this issue. Here, we will remove all key and restart the sshd service .

First take the backup of entire /etc/ssh directory so that we will restore back the keys.

tar -cvzf etc_ssh.tar.gz /etc/ssh

Now list the files once ,for confirmation how many ssh keys exist.

[root@localhost ssh]# ls -l /etc/ssh/ssh*key
-rw-------. 1 root root  668 Jan 17 11:17 /etc/ssh/ssh_host_dsa_key
-rw-------. 1 root root  227 Jan 17 11:17 /etc/ssh/ssh_host_ecdsa_key
-rw-------. 1 root root  419 Jan 17 11:17 /etc/ssh/ssh_host_ed25519_key
-rw-------. 1 root root  991 Jan 17 11:17 /etc/ssh/ssh_host_key
-rw-------. 1 root root 1675 Jan 17 11:17 /etc/ssh/ssh_host_rsa_key
[root@localhost ssh]#

Remove the keys file

rm /etc/ssh/ssh*key

Now restart the ssh service

systemctl restart ssh

IMPORTANT Note: Working on ssh related task is risky, when you have one method of access that is through ssh only . Always be careful while working on ssh.
1. Always connect with server via ssh with two terminal , accessing the same server.
2. Try to use screen command also
3. We do not recommend to use telnet server publicly but you can access via telnet when you do not have any physical access to server. Learn how to install telnet server.

Share this:

  • Twitter
  • Facebook
  • More
  • Print
  • Email
  • LinkedIn
  • Reddit
  • Tumblr
  • Pinterest
  • Pocket
  • Telegram
  • WhatsApp
  • Mastodon

Related posts:

  1. sshd error could not load host key
  2. 4 different commands to check the load average in linux
  3. How to see system load average in terminal with graphical representation
  4. Can’t load ‘/usr/local/lib64/perl5/auto/nginx/nginx.so’
  5. fatal error: error writing to /tmp/ccwAjc9Z.s: No space left on device
  6. error: The requested URL returned error: 403 Forbidden while accessing Github repo
  7. dlopen(): error loading libfuse.so.2 – Got Error On Ubuntu
  8. RSA key authentication in Linux : Passwordless login
  9. Agent admitted failure to sign using the key ssh
  10. How To Get SSH Public Key Fingerprint Information

Filed Under: Linux Tagged With: ssh

Primary Sidebar

Our Social Media Presence

  • Facebook
  • GitHub
  • Twitter

Linux Command

What is Linux Internal And External Command

Linux Basic Commands With Examples For Every Beginner

tr command to convert lines to space , tab and vertical tab

smbpasswd command not found on CentOS 7 and RHEL 7

Solution : semanage command not found

Unix / Linux : How to print duplicate lines from file

More Posts from this Category

You Might Like These Articles!

simplecodesyntax wordpress plugin

SimpleCodeSyntax : My Another WordPress Plugin

Install Nginx

How To Install Nginx On Ubuntu 22.04 LTS

Install Latest Git package in Ubuntu Operating System

How To Always Install Latest Git Package In Ubuntu Operating System

Bash script for installing VirtualBox on Ubuntu 22.04 LTS Desktop

Install VirtualBox On Ubuntu 22.04 LTS Desktop (Bash Script)

libfuse

dlopen(): error loading libfuse.so.2 – Got Error On Ubuntu

Failed to open/create the internal network

VirtualBox Error: Failed to open/create the internal network

Always Useful Tips And Tricks

Read the file inside compressed .gz files without extract

rsync all files,hidden files,symlinks,hardlinks to remotes Linux Server

Print double hyphen sign simultaneously in post of Octopress

Run the script using nohup without hitting enter key two times

How to install korn shell ksh in Linux

Convert hyphen to underscore in between all filenames shell script

Error: Could not stat() command file ‘/var/lib/nagios3/rw/nagios.cmd’!

Explore 90+ Article On "Linux Tips And Tricks"

Copyright © 2023 ยท
The material in this site cannot be republished either online or offline, without our permission.
Proudly Blogging From Bharat.

  • Contact
  • About Me
  • My WordPress plugins
  • Privacy Policy