Original Couldn & #39; t read packet: Connection reset by peer troubleshooting (recommended), couldnpacket

Source: Internet
Author: User
Tags connection reset

Original Couldn't read packet: Connection reset by peer troubleshooting (recommended), couldnpacket

As an O & M engineer, not how much you know is your value, but how many mistakes you encounter are your greatest value.

You know, you have me, you have a lot, you have a lot of mistakes, I have you, it's my value.

I have encountered a very difficult error, so I 'd like to share it with you.

The following example shows how to use the root permission on a simulator to avoid permission errors.

On April 9, September 5, 2017, when I switched to sftp, I encountered an error (the port number is 22 and the port number is closed)

[Root @ backup ssh] # sftp-oPort = 22 root@10.0.0.31

Connecting to 10.0.0.31...

The authenticity of host '10. 0.0.31 (10.0.0.31) 'can't be established.

RSA key fingerprint is 25: 4d: a6: 65: 1b: 77: 85: 41: f0: 18: 07: c8: e0: 12: c9: 9b.

Are you sure you want to continue connecting (yes/no )? Yes

Warning: Permanently added '10. 0.0.31 '(RSA) to the list of known hosts.

Root@10.0.0.31's password:

Subsystem request failed on channel 0

Couldn't read packet: Connection reset by peer

 

Let's take a look at this error.

Couldn't read packet: Connection reset by peer

Unable to read data packets: reset the connection through the peer

This is a very difficult error.

 

Troubleshooting:

Tail-f/var/log/messages

Sep 5 12:31:53 backup sshd [3131]: subsystem request for sftp failed, subsyst found

Sep 5 12:37:15 backup sshd [3136]: Accepted password for root from 10.0.0.31 9088 ssh2

Sep 5 12:37:15 backup sshd [3136]: subsystem request for sftp

Sep 5 12:37:15 backup sshd [3136]: subsystem request for sftp failed, subsyst found

 

 

[Root @ backup ssh] # rpm-ql openssh-clients

/Etc/ssh/ssh_config

/Usr/bin/. ssh. hmac

/Usr/bin/scp

/Usr/bin/sftp

/Usr/bin/slogin

/Usr/bin/ssh

/Usr/bin/ssh-add

/Usr/bin/ssh-agent

/Usr/bin/ssh-copy-id

 

[Root @ backup ssh] # grep sftp/etc/ssh/sshd_config

Subsystem sftp/usr/libexec/openssh/sftp-server

[Root @ backup ssh] # ll/usr/libexec/openssh/sftp-server

-Rwxr-xr-x. 1 root 67640 Mar 22 16:33/usr/libexec/openssh/sftp-server

 

View document

 

 

If so, it's the cause of this error message. that's especially true if your sftp user is logging into a chrooted environment, where "/usr/lib" probably does not exist. my own sftp server is configured this way.

 

However, SSHD has the sftp functionality built-in and does not need to execute an external "helper" program like that. so, if you have a line like the above, it can be fixed by changing it:

If yes, this is the cause of the error message. In particular, if your sftp user logs on to a chrooted environment, "/usr/lib" may not exist. My own sftp server is configured in this way.

 

However, sshd has a built-in sftp function and does not need to execute an external "assistant" program like this. Therefore, if you have a line similar to the above, you can change it:

 

 

Error solution logic diagram

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.