Linux 从套接字读取失败:对等方重置连接

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/7251818/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-05 05:57:49  来源:igfitidea点击:

Read from socket failed: Connection reset by peer

linuxnetworkingssh

提问by frack

I got this exception when the first time I tried to connect my new ubuntu by ssh. I tried to search from google, but no luck until now. Is there anyone who had the same problem before.

当我第一次尝试通过 ssh 连接我的新 ubuntu 时,我遇到了这个异常。我试图从谷歌搜索,但直到现在都没有运气。有没有人以前遇到过同样的问题。

回答by Kevin

Is the sshd server running? Set to accept nonlocal connections (check /etc/sshd/sshd_config)? Do you have a local firewall (iptables) blocking it? If you're trying to go through a router of some sort, does the router have a firewall blocking it?

sshd 服务器是否正在运行?设置为接受非本地连接(检查 /etc/sshd/sshd_config)?您是否有阻止它的本地防火墙(iptables)?如果您试图通过某种路由器,路由器是否有防火墙阻止它?

By default, the OpenSSH server logs to the AUTH facility of syslog, All the details of ssh login attempts will be saved in your /var/log/auth.log file. Check it.

默认情况下,OpenSSH 服务器会登录到 syslog 的 AUTH 设施,所有 ssh 登录尝试的详细信息都将保存在您的 /var/log/auth.log 文件中。核实。

This can occur due to Authentication refused from the other end due to bad permissions in the key files.Recreate the ssh_host_dsa_key and ssh_host_rsa_key if needed(ssh-keygen -t 'dsa/rsa') and overwrite these files in /etc/ssh.Hope this helps

这可能是由于密钥文件中的权限错误而导致另一端拒绝身份验证。如果需要,重新创建 ssh_host_dsa_key 和 ssh_host_rsa_key (ssh-keygen -t 'dsa/rsa') 并覆盖 /etc/ssh.Hope 中的这些文件这有帮助

回答by user207421

'Connection reset by peer' usually means that you have written to a connection that has already been closed by the peer. Alternatively the peer has deliberately reset it, but that is pretty rare.

“对等方重置连接”通常意味着您已写入已被对等方关闭的连接。或者,对等方故意重置它,但这种情况很少见。

Probably you have sent something the peer doesn't understand so it has given up. Are you sure it really is SSH at the other end?

可能你发送了一些对方不理解的东西,所以它已经放弃了。您确定另一端真的是 SSH 吗?