Could not load host key:/etc/ssh/ssh_host_rsa_key
Could not load host key:/etc/ssh/ssh_host_dsa_key
Solution to the problem
Symptoms:
When you start a sshd with a command/usr/sbin/sshd:
System prompts "Could not load host key:/etc/ssh/ssh_host_key
Could not load host key:/etc/ssh/ssh_host_rsa_key
Could not load host key:/etc/ssh/ssh_host_dsa_key
Disabling Protocol version 1. Could not load host key
Disabling Protocol version 2. Could not load host key
Sshd:no Hostkeys available-exiting "
The general meaning is to need a key or something.
The problem lies in:
1, the system lost Ssh_host_dsa_key and Ssh_host_rsa_key
2, the user does not have permission to access these two key
The solution is as follows:
1, the system lost two key:
Enter in Terminal: Ssh-keygen-t dsa-f/etc/ssh/ssh_host_dsa_key rebuild Ssh_host_dsa_key file
The following is the return information
Generating Public/private DSA key pair.
Enter passphrase (empty for No passphrase): (Direct return)
Enter same Passphrase again:
Your identification has been saved In/etc/ssh/ssh_host_dsa_key.
Your public key has been saved in/etc/ssh/ssh_host_dsa_key.pub.
The key fingerprint is:
Xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx Root@localhost.localdomain
Enter in Terminal: Ssh-keygen-t rsa-f/etc/ssh/ssh_host_rsa_key rebuild Ssh_host_rsa_key file
The following is the return information
Generating public/private Rkey pair.
Enter passphrase (empty for No passphrase): (Direct return)
Enter same Passphrase again:
Your identification has been saved In/etc/ssh/ssh_host_rsa_key.
Your public key has been saved in/etc/ssh/ssh_host_dsa_rey.pub.
Root@localhost.localdomain
Now use
/usr/sbin/sshd
You can start sshd successfully
At this point, you can use putty to connect to this Linux host under Windows.
2, the current user does not have the right time to use the command
/usr/sbin/sshd
This also happens when you start the sshd, so this is checking to see if it's root, and the average root user can perform this operation.