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
* https://bbs.archlinux.org/viewtopic.php?id=144449
* http://www.cloudvps.com/community/knowledge-base/regenerating-ssh-host-keys/
* https://www.digitalocean.com/company/blog/avoid-duplicate-ssh-host-keys/
The end.