Trying to start an ssh server. When you encounter this error:

# /usr/sbin/sshd
Could not load host key: /etc/ssh/ssh_host_rsa_key
Could not load host key: /etc/ssh/ssh_host_dsa_key

Here is the solution:

ssh-keygen -A

If you dont have the -A option which generates the host keys, you can generate them like so:

ssh-keygen -t dsa -N "" -f /etc/ssh/ssh_host_dsa_key
ssh-keygen -t rsa -N "" -f /etc/ssh/ssh_host_rsa_key
ssh-keygen -t ecdsa -N "" -f /etc/ssh/ssh_host_ecdsa_key

Technically the above commands are overkill as I ask for dsa, rsa and ecdsa keys when in reality 1 or 2 will do. But in the end having all 3 keys doesnt hurt.

Link to check out

The end.

Leave a Reply

Your email address will not be published. Required fields are marked *