WSL的openssh-server使用报错:Could not load host key: /etc/ssh/ssh_host_rsa_key

如果使用自带的openssh-server会报错:

-> # service ssh restart
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
 * Restarting OpenBSD Secure Shell server 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

解决方法是重新安装一遍ssh:

apt remove openssh-server
apt install openssh-server

安装完成后会帮您自动生成key:

Creating SSH2 RSA key; this may take some time ...
2048 SHA256:SXW3I76yinDKanRfoqoU7wYaGVE4O16OzJjXeqcYb0Q root@sidanzhang-PC0 (RSA)
Creating SSH2 ECDSA key; this may take some time ...
256 SHA256:0CBWETIqv1r2fV5gvTgoIAbKGUWZxHpv7jUOW+g+jhw root@sidanzhang-PC0 (ECDSA)
Creating SSH2 ED25519 key; this may take some time ...
256 SHA256:wpLX9XLMf8YtvFv7Bud6ZdaW0syZ15En5MDH/P654dQ root@sidanzhang-PC0 (ED25519)
invoke-rc.d: could not determine current runlevel

然后启动服务就可以使用了:

-> # service ssh start
 * Starting OpenBSD Secure Shell server sshd
发布了543 篇原创文章 · 获赞 223 · 访问量 71万+
展开阅读全文

没有更多推荐了,返回首页

©️2019 CSDN 皮肤主题: 编程工作室 设计师: CSDN官方博客

分享到微信朋友圈

×

扫一扫,手机浏览