分类: LINUX
2011-12-18 17:32:25
修改sshd_config文件中的protocol 2为protocol 2,1 #man sshd_config可以看到相应格式
之后:
# ssh-keygen -t rsa1 -f /usr/local/etc/ssh_host_key -N ""
Generating public/private rsa1 key pair.
open /usr/local/etc/ssh_host_key failed: No such file or directory.
Saving the key failed: /usr/local/etc/ssh_host_key.
# ssh-keygen -t rsa1 -f /etc/ssh/ssh_host_key -N "" Generating public/private rsa1 key pair.
Your identification has been saved in /etc/ssh/ssh_host_key.
Your public key has been saved in /etc/ssh/ssh_host_key.pub.
The key fingerprint is:
bf:61:5e:7e:09:13:d4:7a:2c:cb:69:74:34:6b:4c:44
# ./ssh restart
Disabling protocol version 1. Could not load host key
Restarting OpenBSD Secure Shell server: sshdDisabling protocol version 1. Could not load host key
.
仍然无法执行,google以下发现:
I figured it out. In my sshd_config I had this setting
# HostKey for protocol version 1
#HostKey /etc/ssh/ssh_host_key
# HostKeys for protocol version 2
HostKey /etc/ssh/ssh_host_rsa_key
HostKey /etc/ssh/ssh_host_dsa_key
This made sshd not load the hostkey for protocol 1.
Fix: Either removing the comment ('#') on protocol 1 or commenting out the
protocol 2 lines.
/Christopher
原来需要指定ssh1的key文件路径,查看man之后发现:
HostKey
Specifies a file containing a private host key used by SSH. The
default is /etc/ssh/ssh_host_key for protocol version 1, and
/etc/ssh/ssh_host_rsa_key and /etc/ssh/ssh_host_dsa_key for pro-
tocol version 2. Note that sshd will refuse to use a file if it
is group/world-accessible. It is possible to have multiple host
key files. ``rsa1'' keys are used for version 1 and ``dsa'' or
``rsa'' are used for version 2 of the SSH protocol.
于是,添加文字到sshd_config:
# HostKeys for protocol version 1
HostKey /etc/ssh/ssh_host_key
# ./ssh restart
Restarting OpenBSD Secure Shell server: sshd.
OK!!