当前位置:网站首页>Xshell连接服务器时报“Could not load host key”错误
Xshell连接服务器时报“Could not load host key”错误
2022-07-26 22:37:00 【Ap21ril】
记录一下配置边缘服务器时遇到的问题
转载自:https://www.cnblogs.com/netonline/p/7410586.html
现象:启动sshd服务时,虽看似服务启动成功,但客户端并不能连接上sshd服务器端。如下:
[[email protected] ~]# /usr/sbin/sshd
Could not load host key: /etc/ssh/ssh_host_rsa_key
Could not load host key: /etc/ssh/ssh_host_ecdsa_key
Could not load host key: /etc/ssh/ssh_host_ed25519_key
原因:
- 从提示信息看是sshd守护进程不能加载主机密钥文件,因为找不到这些密钥文件(配置文件/etc/ssh/sshd_config中已定义密钥文件名与路径);
- 一般openssh服务正常安装后,主机会自动生成相应的主机密钥文件,但这里因未知原因并没有完成这一步动作,导致无法远程ssh连接。
ps:检查密钥文件是否存在(还有一种现象为:密钥文件存在,但文件大小为0):
[[email protected] ~]# ll /etc/ssh/
total 252
-rw-r--r-- 1 root root 242153 Mar 21 22:18 moduli
-rw-r--r-- 1 root root 2208 Mar 21 22:18 ssh_config
-rw------- 1 root root 4361 Mar 21 22:18 sshd_config
解决方案,重新生成主机密钥文件:
生成rsa_key (-t表示生成的密钥所使用的加密类型;-f项后接要生成的密钥文件名);
[[email protected] ~]# ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key
Generating public/private rsa key pair.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /etc/ssh/ssh_host_rsa_key.
Your public key has been saved in /etc/ssh/ssh_host_rsa_key.pub.
The key fingerprint is:
5e:2d:19:51:b1:e3:e0:60:65:53:e4:14:f8:d8:38:af [email protected]
The key's randomart image is:
+--[ RSA 2048]----+
| ==Bo |
| o.= . |
| o o=+ |
| . o+*o. |
| S =oo |
| . . .. |
| . . |
| E |
| |
+-----------------+
[[email protected] ~]# ssh-keygen -t ecdsa -f /etc/ssh/ssh_host_ecdsa_key
生成ecdsa_key;
[[email protected] ~]# ssh-keygen -t ecdsa -f /etc/ssh/ssh_host_ecdsa_key
生成ed25519_key。
[[email protected] ~]# ssh-keygen -t ed25519 -f /etc/ssh/ssh_host_ed25519_key
最后重启sshd
service ssh restart
大功告成
边栏推荐
- ES6新特性
- 11_ Weather case - monitoring properties
- 100. Same tree
- Azure synapse analytics Performance Optimization Guide (3) -- optimize performance using materialized views (Part 2)
- 4-4 对象生命周期
- New features of ES6
- Codeforces C1. Simple Polygon Embedding
- Chapter 1 Introduction and use skills of interceptors
- Tensorflow2.0 deep learning simple tutorial of running code
- Design of alcohol detector based on 51 single chip microcomputer
猜你喜欢
![Embedded system migration [8] - device tree and root file system migration](/img/af/5b5d38522f0cc434bdafbf892936ee.png)
Embedded system migration [8] - device tree and root file system migration

04 traditional synchronized lock

告别宽表,用 DQL 成就新一代 BI

NFT display guide: how to display your NFT collection

About no module named'django.db.backends.mysql'

第1章 开发第一个restful应用

动态sql

C language array

买不到的数目

Chapter 1 Introduction and use skills of interceptors
随机推荐
Method of realizing program startup and self startup through registry
Galaxy securities online account opening commission, is online account opening safe for customer managers
ES6新特性
Mysql database complex operations: Database Constraints, query / connect table operations
Re understand the life world and ourselves
The attorney general and the director of the national security service of Ukraine were dismissed
MVC three-tier architecture
简单的SQL优化
第7章 课程总结
股票开户佣金是否可以调整?手机上开户安不安全
查看 Anaconda 创建环境的位置
Can the stock account opening commission be adjusted? Is it safe to open an account on your mobile phone
Training team lpoj round10 d come minion!
07 design of ponding monitoring system based on 51 single chip microcomputer
Topological sorting (learning notes) introduction + judge whether there is a ring
Codeforces C1. Simple Polygon Embedding
Share a regular expression
[2016] [paper notes] differential frequency tunable THz technology——
PTA 7-4 small generation (DFS)
Tensorflow2.0 deep learning simple tutorial of running code