Job for ssh.service failed because the control process exited with error code.......

在移植Ubuntu系统时遇到了SSH服务无法启动的问题,主要是因为缺少主机密钥。通过运行`ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key`生成新的RSA密钥对解决了这个问题。然而,之后启动SSH服务时提示缺少权限分离目录。尽管生成了密钥,但服务仍未能正常启动。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

移植ubuntu rootfs过程中出现ssh问题

root@kal:~# service ssh start
Job for ssh.service failed because the control process exited with error code.
See "systemctl status ssh.service" and "journalctl -xe" for details.

查看原因

root@kal:~# /usr/sbin/sshd -T
sshd: no hostkeys available -- exiting.

 

解决过程:
#ssh-keygen -t dsa -f /etc/ssh/ssh_host_dsa_key
#ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key

如下ok

root@kal:~# 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:
SHA256:2PQheuQ/LwNqPwz2K25AsF9xyt0ZnnJWhu7ATB38n3M root@huida
The key's randomart image is:
+---[RSA 3072]----+
|         o.o     |
|  .   . o = o    |
|   o . O++.B     |
|  . . +B*oO..    |
|   o .o S*.  . . |
|    o o....   + E|
|     o = .o    o |
|      = + oo     |
|     +.ooo o.    |
+----[SHA256]-----+
root@kal:~# /usr/sbin/sshd -T
Missing privilege separation directory: /run/sshd
root@kal:~# service ssh start
root@kal:~#

 

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值