ssh 詢問密碼;但然後“從遠端主機讀取...連接被對等方重置”

ssh 詢問密碼;但然後“從遠端主機讀取...連接被對等方重置”

當我嘗試連接到遠端伺服器時,ssh 要求輸入密碼並進行檢查(如果我輸入錯誤的密碼,它會顯示「權限被拒絕」),但不讓我進入:

$ ssh user11@123
user11@123's password:

什麼也沒發生,一段時間後:

Read from remote host 123: Connection reset by peer

123是隱藏伺服器的IP。

ssh 和 sftp 都執行此操作。

遠端是linux+OpenSSH,一週前ssh工作正常。

在 -vvv 模式下輸入密碼後

debug3: packet_send2: adding 64 (len 58 padlen 6 extra_pad 64)
debug2: we sent a password packet, wait for reply
debug1: Authentication succeeded (password).
debug1: channel 0: new [client-session]
debug3: ssh_session2_open: channel_new: 0
debug2: channel 0: send open
debug1: Entering interactive session.

一段時間後...

debug1: channel 0: free: client-session, nchannels 1
debug3: channel 0: status: The following connections are open:
  #0 client-session (t3 r-1 i0/0 o0/0 fd 4/5 cfd -1)

debug3: channel 0: close_fds r 4 w 5 e 6 c -1
Read from remote host 123: Connection reset by peer
debug1: Transferred: stdin 0, stdout 0, stderr 63 bytes in 117.1 seconds
debug1: Bytes per second: stdin 0.0, stdout 0.0, stderr 0.5

答案1

造成這種情況的原因可能有多種,這裡沒有足夠的資訊來準確縮小問題範圍。

您必須檢查伺服器“123”上的各種日誌檔案才能/var/log查看發生了什麼。這意味著如果您無法透過 SSH 連接到它,請檢查它的控制台。

可能原因的(不完整)清單可能是:

  • 伺服器上某種失控的進程填滿了進程表,這意味著它無法產生您的 shell
  • RAM 不足,無法產生 shell。
  • 硬碟故障,這意味著即使 sshd 可能仍然存在,它也無法從磁碟載入您的 shell。
  • 您的登入 shell 設定不正確/bin/false或其他
  • rm -rf /有人覺得這對你的伺服器來說很有趣。
  • 有些腳本小子嘗試安裝 rootkit,但搞砸了,導致 shell 無法啟動。

無論哪種方式,您都必須轉到伺服器的控制台以查看可能發生的情況。

相關內容