sshd: no hostkeys available

Aug 29 08:20:29 ceph-ubuntu-1 sshd[1498]: sshd: no hostkeys available -- exiting.
Aug 29 08:20:29 ceph-ubuntu-1 systemd[1]: ssh.service: Control process exited, code=exited, status=1/FAILURE
Aug 29 08:20:29 ceph-ubuntu-1 systemd[1]: ssh.service: Failed with result 'exit-code'.
Aug 29 08:20:29 ceph-ubuntu-1 systemd[1]: Failed to start OpenBSD Secure Shell server.
Aug 29 08:20:29 ceph-ubuntu-1 systemd[1]: ssh.service: Scheduled restart job, restart counter is at 3.

sshd 데몬이 기동되지 않고 위와같은 오류가 발생하는 경우가 있다.
/etc/ssh/sshd_host_* key 파일들이 삭제되었을때 발생하는 오류이다. 일반적으로 sshd데몬을 재기동하면 자동으로 생성하지만 Ubuntu계열같은 일부 리눅스 배포판에서는 자동으로 생성해주지 않아 이와 같은 오류가 발생할 수 있다.

아래 명령어로 키파일을 생성하여 해결할 수 있다.

ssh-keygen -A

root@ceph-ubuntu-1:~# ssh-keygen -A