ssh链接报Read from socket failed: Connection reset by peer

2023年 7月 15日 62.6k 0

chown www.www /*后出现链接不上Read from socket failed: Connection reset by peer

[root@linuxea-com ~]#  tail -f /var/log/auth.log 

日志中报错type=USER_LOGIN msg=audit(1482840012.303:122122): pid=12106 uid=0 auid=4294967295 ses=4294967295 msg='op=login acct="(unknown)"添加参数 -v 获得更详细的连接信息 ssh user@computerB -v 如果是 rsa and dsa keys 丢失产生的问题, 可以通过下面的方式进行修复:

[root@linuxea-com ~]# ssh-keygen -t rsa1 -f /etc/ssh/ssh_host_rsa_key 
[root@linuxea-com ~]# ssh-keygen -t dsa  -f /etc/ssh/ssh_host_dsa_key

如果还提示Read from socket failed: Connection reset by peer,查看权限是否匹配.ssh的权限位644

[root@linuxea-com ~]#  ll /root/.ssh/
总用量 8
-rw-r--r--. 1 root root 1176 12月 27 17:05 authorized_keys
-rw-r--r--  1 root root  174 12月 28 09:46 known_hosts

/etc/ssh的权限如下

[root@linuxea-com ~]#  ll /etc/ssh
总用量 276
-rw-r--r--  1 root root     242153 3月  22 2016 moduli
-rw-r--r--  1 root root       2208 3月  22 2016 ssh_config
-rw-------. 1 root root       4327 4月  15 2016 sshd_config
-rw-r-----. 1 root ssh_keys    227 4月  15 2016 ssh_host_ecdsa_key
-rw-r--r--. 1 root root        162 4月  15 2016 ssh_host_ecdsa_key.pub
-rw-r-----. 1 root ssh_keys    387 4月  15 2016 ssh_host_ed25519_key
-rw-r--r--. 1 root root         82 4月  15 2016 ssh_host_ed25519_key.pub
-rw-r-----. 1 root ssh_keys   1675 4月  15 2016 ssh_host_rsa_key
-rw-r--r--. 1 root root        382 4月  15 2016 ssh_host_rsa_key.pub
[root@linuxea-com ~]# 

如果出现找不到匹配的host key算法,我们将/et/ssh目录下的ssh_host_*的所有文件移走,重启sshd即可其他服务,则需要修改目录的权限,和一些pid以及日志的权限

相关文章

服务器端口转发,带你了解服务器端口转发
服务器开放端口,服务器开放端口的步骤
产品推荐:7月受欢迎AI容器镜像来了,有Qwen系列大模型镜像
如何使用 WinGet 下载 Microsoft Store 应用
百度搜索:蓝易云 – 熟悉ubuntu apt-get命令详解
百度搜索:蓝易云 – 域名解析成功但ping不通解决方案

发布评论