当前位置: 技术问答>linux和unix
Ubuntu Linux中ssh错误
来源: 互联网 发布时间:2017-01-17
本文导语: 服务器启动时: could not load host key /etc/ssh/ssh_host_rsa_key 客户端连接时,总提示‘Read from socket failed: Connection reset by peer’: xiaogw@R715:/tftpboot/xiaogw$ ssh -vvv 192.168.1.2 OpenSSH_5.3p1 Debian-3ubuntu7, OpenSSL 0.9.8k 25 Mar...
服务器启动时:
could not load host key /etc/ssh/ssh_host_rsa_key
客户端连接时,总提示‘Read from socket failed: Connection reset by peer’:
xiaogw@R715:/tftpboot/xiaogw$ ssh -vvv 192.168.1.2
OpenSSH_5.3p1 Debian-3ubuntu7, OpenSSL 0.9.8k 25 Mar 2009
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug2: ssh_connect: needpriv 0
debug1: Connecting to 192.168.1.2 [192.168.1.2] port 22.
debug1: Connection established.
debug1: identity file /home/xiaogw/.ssh/identity type -1
debug1: identity file /home/xiaogw/.ssh/id_rsa type -1
debug1: identity file /home/xiaogw/.ssh/id_dsa type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_4.7p1 Debian-8ubuntu3
debug1: match: OpenSSH_4.7p1 Debian-8ubuntu3 pat OpenSSH_4*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_5.3p1 Debian-3ubuntu7
debug2: fd 3 setting O_NONBLOCK
debug1: SSH2_MSG_KEXINIT sent
debug3: Wrote 792 bytes for a total of 831
Read from socket failed: Connection reset by peer
请问怎样解决这个问题呢?谢谢了
could not load host key /etc/ssh/ssh_host_rsa_key
客户端连接时,总提示‘Read from socket failed: Connection reset by peer’:
xiaogw@R715:/tftpboot/xiaogw$ ssh -vvv 192.168.1.2
OpenSSH_5.3p1 Debian-3ubuntu7, OpenSSL 0.9.8k 25 Mar 2009
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug2: ssh_connect: needpriv 0
debug1: Connecting to 192.168.1.2 [192.168.1.2] port 22.
debug1: Connection established.
debug1: identity file /home/xiaogw/.ssh/identity type -1
debug1: identity file /home/xiaogw/.ssh/id_rsa type -1
debug1: identity file /home/xiaogw/.ssh/id_dsa type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_4.7p1 Debian-8ubuntu3
debug1: match: OpenSSH_4.7p1 Debian-8ubuntu3 pat OpenSSH_4*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_5.3p1 Debian-3ubuntu7
debug2: fd 3 setting O_NONBLOCK
debug1: SSH2_MSG_KEXINIT sent
debug3: Wrote 792 bytes for a total of 831
Read from socket failed: Connection reset by peer
请问怎样解决这个问题呢?谢谢了
|
把1楼和2楼的答案结合起来
首先,检查一下当前用户家目录里有没有/home/用户名/.ssh/id_rsa.pub文件,这个是公钥,有了起码说明你之前在本机生成过密钥对
如果没有这个文件,肯定不能用密钥的方式登录的,那就需要先把服务器的验证方式改成密码验证,需要改服务器端的配置文件,好像是/etc/ssh/sshd_config之类的,里面找一下,有一个“Author...by..passwd”之类的,后面改成yes,改完后要重启ssh服务,“service sshd restart”
在本地生成密钥对,用密码验证的方式登录ssh,把公钥拷贝到服务器,这样应该可以了
首先,检查一下当前用户家目录里有没有/home/用户名/.ssh/id_rsa.pub文件,这个是公钥,有了起码说明你之前在本机生成过密钥对
如果没有这个文件,肯定不能用密钥的方式登录的,那就需要先把服务器的验证方式改成密码验证,需要改服务器端的配置文件,好像是/etc/ssh/sshd_config之类的,里面找一下,有一个“Author...by..passwd”之类的,后面改成yes,改完后要重启ssh服务,“service sshd restart”
在本地生成密钥对,用密码验证的方式登录ssh,把公钥拷贝到服务器,这样应该可以了
|
把服务器端的验证模式改成密码验证,若客户端能正常登陆,再尝试用KEY验证
|
could not load host key /etc/ssh/ssh_host_rsa_key
检查此文件,一般当前用户下有这个id_ras.pub
检查此文件,一般当前用户下有这个id_ras.pub