When you start the SSHD service, you are quoted as an error message: Reference #/USR/LOCAL/SBIN/SSHD
Could not load host key:/usr/local/etc/ssh/ssh_host_rsa1_key
Could not load host key:/usr/local/etc/ssh/ssh_host_rsa_key
Could not load host key:/usr/local/etc/ssh/ssh_host_dsa_key
Disabling Protocol version 2. Could not load host key
Sshd:no Hostkeys available--exiting.
First, the cause of the failure
As you can see from the hint, the problem occurs because the SSHD server did not find the private key it needed when it started. The general OpenSSH version supports three protocols: RSA1, RSA2, and DSA, which are determined in the configuration file: Reference # Cat/usr/local/etc/ssh/sshd_config |grep Hostkey
# Hostkey for protocol version 1
Hostkey/usr/local/etc/ssh/ssh_host_rsa1_key
# Hostkeys for protocol version 2
Hostkey/usr/local/etc/ssh/ssh_host_rsa_key
Hostkey/usr/local/etc/ssh/ssh_host_dsa_key
※ Note that depending on the configuration file definition, such as the use of source code, or PKG package installation, these paths may be different. Linux RPM-defined configuration files that are different from the default name and path for the above key in the configuration file on the SCO source installation. Need to operate according to the actual situation.
The workaround is simple, as long as you generate the above few private key files and give the appropriate permissions.
ii. problem-solving
We know that this is not usually the case under Linux distributions, because the RPM packages provided by the system have already generated the operations of these files and are placed before booting. If you have just finished installing the system, the first time you start the sshd service, there will be: Quote # service SSHD start
Generate SSH1 RSA host key: [OK]
Generate SSH2 RSA host key: [OK]
Generating SSH2 DSA host key: [OK]
Start sshd: [OK]
In this case, we can refer to the Sshd startup script to generate the relevant key.
You can view the operation of three functions such as Do_rsa1_keygen () in/etc/init.d/sshd, no more than one by one instructions.
To be converted to SCO, the specific steps to be done are:
# cd/usr/local/etc/ssh/
#/usr/local/bin/ssh-keygen-q-T rsa1-f./ssh_host_rsa1_key-c '-n '
# chmod/ssh_host_rsa1_key.
# chmod 644./ssh_host_rsa1_key.pub
#/usr/local/bin/ssh-keygen-q-T rsa-f./ssh_host_rsa_key-c '-n '
# chmod/ssh_host_rsa_key.
# chmod 644./ssh_host_rsa_key.pub
#/usr/local/bin/ssh-keygen-q-T dsa-f./ssh_host_dsa_key-c '-n '
# chmod/ssh_host_dsa_key.
# chmod 644./ssh_host_dsa_key.pub
Finally, the SSHD service can be started:
Upon completion. Reboot sshd:
Service sshd restart/etc/init.d/sshd Restart #/usr/local/sbin/sshd
# Netstat-an|grep 22
Solve the problem.