• 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

sshd error could not load host key

October 8, 2018 by Sharad Chhetri

After a long gap of time,encountering with ‘sshd error: could not load host key’. The fixing is quite easy in Ubuntu system yet you shuold be careful while solving the issue.

This time we found this problem in Ubuntu 18.04 LTS Server Edition.

Sep 29 16:01:28 lab sshd[1088]: error: key_load_private: invalid format
Sep 29 16:01:28 lab sshd[1088]: error: key_load_public: invalid format
Sep 29 16:01:28 lab sshd[1088]: error: Could not load host key: /etc/ssh/ssh_host_rsa_key
Sep 29 16:01:28 lab sshd[1088]: error: key_load_private: invalid format
Sep 29 16:01:28 lab sshd[1088]: error: key_load_public: invalid format
Sep 29 16:01:28 lab sshd[1088]: error: Could not load host key: /etc/ssh/ssh_host_ecdsa_key
Sep 29 16:01:28 lab sshd[1088]: error: key_load_private: invalid format
Sep 29 16:01:28 lab sshd[1088]: error: key_load_public: invalid format
Sep 29 16:01:28 lab sshd[1088]: error: Could not load host key: /etc/ssh/ssh_host_ed25519_key
Sep 29 16:01:28 lab sshd[1088]: fatal: No supported key exchange algorithms [preauth]

How to fix “sshd error: could not load host key”

  1. First take the backup of ssh config folder. In case of any blunder, you can restore the file to previous state.
  2. sudo cp -rvf /etc/sshd ~/sshd-backup
    
  3. Remove ssh host key.
  4. sudo rm /etc/ssh/ssh*key
    
  5. Regenerate ssh key
  6. sudo dpkg-reconfigure openssh-server
    
  7. Restart the openssh-server
  8. sudo systemctl restart ssh
    

    Now try connecting by using ssh command to server/system.Hope it will be working!

Share this:

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

Related posts:

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

Change the default port number of ssh server

Protect from w00tw00t.at.blackhats.romanian.anti-sec

How to set JAVA environment variables in Linux

How to configure htdigest in nagios server

How to install pam_mysql in CentOS or Red Hat

How to empty Trash through command line in Ubuntu

Agent admitted failure to sign using the key ssh

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