Ssh server: could not load host key

debiansshssh-keys

I'm configuring ssh server, but have faced an issue.

First I generate the private/public rsa keys with:
ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key
and set password on prompt.

Then try to start sshd:
/etc/init.d/ssh start
but get errors:

Could not load host key: /etc/ssh/ssh_host_rsa_key
Disabling protocol version 2. Could not load host key
sshd: no hostkeys available — exiting.

Key point: Everything works if a leave password for the private key empty when generating keys, but the above errors occur otherwise. Still though, leaving that password empty is not recommended.

Any ideas? Thanks.

Best Answer

Host keys can't be protected with passwords, so just leave that empty.