目 录CONTENT

文章目录

error: Could not load host key

xlong
2024-06-27 / 0 评论 / 0 点赞 / 18 阅读 / 722 字 / 正在检测是否收录...

启动sshd 报错:

报错详细信息:

# /usr/sbin/sshd -D
error: Could not load host key: /etc/ssh/ssh_host_rsa_key
error: Could not load host key: /etc/ssh/ssh_host_dsa_key
error: Could not load host key: /etc/ssh/ssh_host_ecdsa_key

解决方法:

# -A:对于不存在主机密钥的每种密钥类型(rsa1、rsa、dsa、ecdsa 和 ed25519),使用默认密钥文件路径、空密码、密钥类型的默认位和默认注释生成主机密钥。/etc/rc 会使用它来生成新的主机密钥。
ssh-keygen -A 

# 或者执行
ssh-keygen -q -N "" -t dsa -f /etc/ssh/ssh_host_dsa_key
ssh-keygen -q -N "" -t rsa -b 4096 -f /etc/ssh/ssh_host_rsa_key
ssh-keygen -q -N "" -t ecdsa -f /etc/ssh/ssh_host_ecdsa_key
ssh-keygen -q -N "" -t ed25519 -f /etc/ssh/ssh_host_ed25519_key

0

评论区