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.

1 Answer 1


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

  • Thank you for your answer. Though, I'm confused. Why is ssh-keygen prompts for a password in that case? Also, as I read at wiki.debian.org/SSH: "Note: We recommend to not leave the passphrase empty." Can you, please, further explain your point?
    – Pavel A
    Feb 11, 2013 at 19:19
  • 1
    @PavelA Because ssh-keygen is also used for generating user SSH keys, which should be password protected. In most distros you don't generate the host keys manually, so most users don't encounter that message in the context of host keys.
    – mgorven
    Feb 11, 2013 at 19:25
  • Okay, I've got it - thanks! Yeah, it is a very out-dated system (Debian Etch). On my Ubuntu system they have been generated as part of openssh-server package installation.
    – Pavel A
    Feb 11, 2013 at 19:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.