Read from socket failed: Connection reset by peer 问题
2014-02-10 15:51
579 查看
http://blog.sina.com.cn/s/blog_893ee27f0100z5pt.html
通常,在linux中使用ssh的时候,如果出现这个错误,建议首先去查看log。
ubuntu的ssh的log记录在/var/log/auth.log
log错误会类似于如下:
Dec 22 09:43:35 x079-liongao sshd[14892]: error: This private key will be ignored.
Dec 22 09:43:35 x079-liongao sshd[14892]: error: bad permissions: ignore key: /etc/ssh/ssh_host_dsa_key
Dec 22 09:43:35 x079-liongao sshd[14892]: error: Could not load host key: /etc/ssh/ssh_host_dsa_key
Dec 22 09:43:35 x079-liongao sshd[14892]: error: This private key will be ignored.
Dec 22 09:43:35 x079-liongao sshd[14892]: error: bad permissions: ignore key: /etc/ssh/ssh_host_rsa_key
Dec 22 09:43:35 x079-liongao sshd[14892]: error: Could not load host key: /etc/ssh/ssh_host_rsa_key
找到问题所在,用如下命令
ssh-keygen -t dsa -P '' -f /etc/ssh/ssh_host_dsa_key
ssh-keygen -t rsa -P '' -f /etc/ssh/ssh_host_rsa_key
分别把这两个密钥生成就可以正常启动和使用 ssh了 。
到此问题就解决完了。
如果想深层次的了解这个的话可以去看看
/etc/ssh/ssh_config 和 /etc/ssh/sshd_config
据我所知 ssh 的配置文件就是这两个。
通常,在linux中使用ssh的时候,如果出现这个错误,建议首先去查看log。
ubuntu的ssh的log记录在/var/log/auth.log
log错误会类似于如下:
Dec 22 09:43:35 x079-liongao sshd[14892]: error: This private key will be ignored.
Dec 22 09:43:35 x079-liongao sshd[14892]: error: bad permissions: ignore key: /etc/ssh/ssh_host_dsa_key
Dec 22 09:43:35 x079-liongao sshd[14892]: error: Could not load host key: /etc/ssh/ssh_host_dsa_key
Dec 22 09:43:35 x079-liongao sshd[14892]: error: This private key will be ignored.
Dec 22 09:43:35 x079-liongao sshd[14892]: error: bad permissions: ignore key: /etc/ssh/ssh_host_rsa_key
Dec 22 09:43:35 x079-liongao sshd[14892]: error: Could not load host key: /etc/ssh/ssh_host_rsa_key
找到问题所在,用如下命令
ssh-keygen -t dsa -P '' -f /etc/ssh/ssh_host_dsa_key
ssh-keygen -t rsa -P '' -f /etc/ssh/ssh_host_rsa_key
分别把这两个密钥生成就可以正常启动和使用 ssh了 。
到此问题就解决完了。
如果想深层次的了解这个的话可以去看看
/etc/ssh/ssh_config 和 /etc/ssh/sshd_config
据我所知 ssh 的配置文件就是这两个。
相关文章推荐
- Read from socket failed: Connection reset by peer 问题
- 【OpenStack】SSH登录虚拟机出现"Read from socket failed: Connection reset by peer"问题的解决办法
- 【OpenStack】SSH登录虚拟机出现"Read from socket failed: Connection reset by peer"问题的解决办法
- Read from socket failed: Connection reset by peer 问题
- ssh Read from socket failed: Connection reset by peer
- Ubuntu上的Read from socket failed: Connection reset by peer
- SSH error ( Read from socket failed: Connection reset by peer ) and it's solution
- Read from socket failed: Connection reset by peer
- SSH error ( Read from socket failed: Connection reset by peer ) and it's solution
- CentOS7使用ssh不能登录,报错:Read from socket failed: Connection reset by peer
- Read from socket failed: Connection reset by peer
- Read from socket failed: Connection reset by peer
- SSH 错误解决案例1:Read from socket failed: Connection reset by peer
- Read from socket failed: Connection reset by peer.
- 使用Mob短信验证出现 java.net.SocketException: recvfrom failed: ECONNRESET (Connection reset by peer)异常
- java.net.SocketException: recvfrom failed: ECONNRESET (Connection reset by peer)我的解决办法
- java.net.SocketException: recvfrom failed: ECONNRESET (Connection reset by peer)
- java.net.SocketException: recvfrom failed: ECONNRESET (Connection reset by peer)
- php502问题解决:recv() failed (104: Connection reset by peer) while reading response header from upstream
- java.net.SocketException: recvfrom failed: ECONNRESET (Connection reset by peer)