解决Ubuntu下ssh无法启动
Ubuntu ssh一直无法启动。
通过 systemctl status ssh.service 查看到的错误是
Dec 16 13:35:22 iZm5eckxl2tqyka9eoe7b3Z systemd[1]: Starting OpenBSD Secure Shell server...
Dec 16 13:35:22 iZm5eckxl2tqyka9eoe7b3Z sshd[19621]: Could not load host key: /etc/ssh/ssh_host_ed25519_key
Dec 16 13:35:22 iZm5eckxl2tqyka9eoe7b3Z sshd[19621]: Missing privilege separation directory: /var/run/sshd
Dec 16 13:35:22 iZm5eckxl2tqyka9eoe7b3Z systemd[1]: ssh.service: Main process exited, code=exited, status=255/n/a
Dec 16 13:35:22 iZm5eckxl2tqyka9eoe7b3Z systemd[1]: Failed to start OpenBSD Secure Shell server.
Dec 16 13:35:22 iZm5eckxl2tqyka9eoe7b3Z systemd[1]: ssh.service: Unit entered failed state.
Dec 16 13:35:22 iZm5eckxl2tqyka9eoe7b3Z systemd[1]: ssh.service: Failed with result 'exit-code'
解决方法
ssh-keygen -A mkdir -p /var/run/sshd