linux openssh密码错误,Ubuntu Linux中ssh错误

服务器启动时:

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,把公钥拷贝到服务器,这样应该可以了

|

把服务器端的验证模式改成密码验证,若客户端能正常登陆,再尝试用KEY验证

|

could not load host key /etc/ssh/ssh_host_rsa_key

检查此文件,一般当前用户下有这个id_ras.pub

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值