原創Couldn't read packet: Connection reset by peer 錯誤排查思路(推薦),couldnpacket

來源:互聯網
上載者:User

原創Couldn't read packet: Connection reset by peer 錯誤排查思路(推薦),couldnpacket

作為一個營運 不是你懂多少知識才是你的價值 你有幸能遇到多少錯誤才是你的最大的價值

知識 你有我有大家有  錯誤我有你沒有 這便是我的價值

我遇到一個錯誤 蠻難遇到的一個錯誤 所以想分享給大家 

下面我在類比機示範給大家 用 root許可權 避免你們說是因為許可權的錯誤

2017年9月5日 我在切換sftp時候遇到一個錯誤(連接埠號碼是22 說寫連接埠號碼的閉嘴)

[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

 

我們來看看這個錯誤 

Couldn't read packet: Connection reset by peer

 無法讀取資料包:通過對等項重設串連

這是一個很難遇到的錯誤

 

排查之路:

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 root 67640 Mar 22 16:33 /usr/libexec/openssh/sftp-server

 

查看文檔

 

 

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 to:

如果是,這是錯誤訊息的原因。尤其是,如果您的sftp使用者登入到一個chrooted環境,其中“/ usr /lib”可能不存在。我自己的sftp伺服器是這樣配置的。

 

但是,sshd具有內建的sftp功能,不需要執行像這樣的外部“助手”程式。因此,如果您有類似上述的行,可以通過將其更改為:

 

 

 錯誤解決邏輯圖

 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.